<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP, BangPatterns #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE MagicHash #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# OPTIONS_HADDOCK prune #-}</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__ &gt;= 701
</span><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Module      : Data.ByteString.Char8</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Copyright   : (c) Don Stewart 2006-2008</span><span>
</span><span id="line-11"></span><span class="hs-comment">--               (c) Duncan Coutts 2006-2011</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- License     : BSD-style</span><span>
</span><span id="line-13"></span><span class="hs-comment">--</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Maintainer  : dons00@gmail.com, duncan@community.haskell.org</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- Stability   : stable</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- Portability : portable</span><span>
</span><span id="line-17"></span><span class="hs-comment">--</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- Manipulate 'ByteString's using 'Char' operations. All Chars will be</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- truncated to 8 bits. It can be expected that these functions will run</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- at identical speeds to their 'Word8' equivalents in &quot;Data.ByteString&quot;.</span><span>
</span><span id="line-21"></span><span class="hs-comment">--</span><span>
</span><span id="line-22"></span><span class="hs-comment">-- More specifically these byte strings are taken to be in the</span><span>
</span><span id="line-23"></span><span class="hs-comment">-- subset of Unicode covered by code points 0-255. This covers</span><span>
</span><span id="line-24"></span><span class="hs-comment">-- Unicode Basic Latin, Latin-1 Supplement and C0+C1 Controls.</span><span>
</span><span id="line-25"></span><span class="hs-comment">--</span><span>
</span><span id="line-26"></span><span class="hs-comment">-- See:</span><span>
</span><span id="line-27"></span><span class="hs-comment">--</span><span>
</span><span id="line-28"></span><span class="hs-comment">--  * &lt;http://www.unicode.org/charts/&gt;</span><span>
</span><span id="line-29"></span><span class="hs-comment">--</span><span>
</span><span id="line-30"></span><span class="hs-comment">--  * &lt;http://www.unicode.org/charts/PDF/U0000.pdf&gt;</span><span>
</span><span id="line-31"></span><span class="hs-comment">--</span><span>
</span><span id="line-32"></span><span class="hs-comment">--  * &lt;http://www.unicode.org/charts/PDF/U0080.pdf&gt;</span><span>
</span><span id="line-33"></span><span class="hs-comment">--</span><span>
</span><span id="line-34"></span><span class="hs-comment">-- This module is intended to be imported @qualified@, to avoid name</span><span>
</span><span id="line-35"></span><span class="hs-comment">-- clashes with &quot;Prelude&quot; functions.  eg.</span><span>
</span><span id="line-36"></span><span class="hs-comment">--</span><span>
</span><span id="line-37"></span><span class="hs-comment">-- &gt; import qualified Data.ByteString.Char8 as C</span><span>
</span><span id="line-38"></span><span class="hs-comment">--</span><span>
</span><span id="line-39"></span><span class="hs-comment">-- The Char8 interface to bytestrings provides an instance of IsString</span><span>
</span><span id="line-40"></span><span class="hs-comment">-- for the ByteString type, enabling you to use string literals, and</span><span>
</span><span id="line-41"></span><span class="hs-comment">-- have them implicitly packed to ByteStrings.</span><span>
</span><span id="line-42"></span><span class="hs-comment">-- Use @{-\# LANGUAGE OverloadedStrings \#-}@ to enable this.</span><span>
</span><span id="line-43"></span><span class="hs-comment">--</span><span>
</span><span id="line-44"></span><span>
</span><span id="line-45"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.ByteString.Char8</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-46"></span><span>
</span><span id="line-47"></span><span>        </span><span class="annot"><span class="hs-comment">-- * The @ByteString@ type</span></span><span>
</span><span id="line-48"></span><span>        </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier">ByteString</span></a></span><span class="hs-special">,</span><span>             </span><span class="hs-comment">-- abstract, instances: Eq, Ord, Show, Read, Data, Typeable, Monoid</span><span>
</span><span id="line-49"></span><span>
</span><span id="line-50"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Introducing and eliminating 'ByteString's</span></span><span>
</span><span id="line-51"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#empty"><span class="hs-identifier">empty</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: ByteString</span><span>
</span><span id="line-52"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#singleton"><span class="hs-identifier">singleton</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: Char   -&gt; ByteString</span><span>
</span><span id="line-53"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#pack"><span class="hs-identifier">pack</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: String -&gt; ByteString</span><span>
</span><span id="line-54"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#unpack"><span class="hs-identifier">unpack</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: ByteString -&gt; String</span><span>
</span><span id="line-55"></span><span>
</span><span id="line-56"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Basic interface</span></span><span>
</span><span id="line-57"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#cons"><span class="hs-identifier">cons</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: Char -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-58"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#snoc"><span class="hs-identifier">snoc</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: ByteString -&gt; Char -&gt; ByteString</span><span>
</span><span id="line-59"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#append"><span class="hs-identifier">append</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-60"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#head"><span class="hs-identifier">head</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: ByteString -&gt; Char</span><span>
</span><span id="line-61"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#uncons"><span class="hs-identifier">uncons</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: ByteString -&gt; Maybe (Char, ByteString)</span><span>
</span><span id="line-62"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#unsnoc"><span class="hs-identifier">unsnoc</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: ByteString -&gt; Maybe (ByteString, Char)</span><span>
</span><span id="line-63"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#last"><span class="hs-identifier">last</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: ByteString -&gt; Char</span><span>
</span><span id="line-64"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#tail"><span class="hs-identifier">tail</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: ByteString -&gt; ByteString</span><span>
</span><span id="line-65"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#init"><span class="hs-identifier">init</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: ByteString -&gt; ByteString</span><span>
</span><span id="line-66"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#null"><span class="hs-identifier">null</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: ByteString -&gt; Bool</span><span>
</span><span id="line-67"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#length"><span class="hs-identifier">length</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: ByteString -&gt; Int</span><span>
</span><span id="line-68"></span><span>
</span><span id="line-69"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Transforming ByteStrings</span></span><span>
</span><span id="line-70"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#map"><span class="hs-identifier">map</span></a></span><span class="hs-special">,</span><span>                    </span><span class="hs-comment">-- :: (Char -&gt; Char) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-71"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#reverse"><span class="hs-identifier">reverse</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: ByteString -&gt; ByteString</span><span>
</span><span id="line-72"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#intersperse"><span class="hs-identifier">intersperse</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: Char -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-73"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#intercalate"><span class="hs-identifier">intercalate</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: ByteString -&gt; [ByteString] -&gt; ByteString</span><span>
</span><span id="line-74"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#transpose"><span class="hs-identifier">transpose</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: [ByteString] -&gt; [ByteString]</span><span>
</span><span id="line-75"></span><span>
</span><span id="line-76"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Reducing 'ByteString's (folds)</span></span><span>
</span><span id="line-77"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#foldl"><span class="hs-identifier">foldl</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: (a -&gt; Char -&gt; a) -&gt; a -&gt; ByteString -&gt; a</span><span>
</span><span id="line-78"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#foldl%27"><span class="hs-identifier">foldl'</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: (a -&gt; Char -&gt; a) -&gt; a -&gt; ByteString -&gt; a</span><span>
</span><span id="line-79"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#foldl1"><span class="hs-identifier">foldl1</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: (Char -&gt; Char -&gt; Char) -&gt; ByteString -&gt; Char</span><span>
</span><span id="line-80"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#foldl1%27"><span class="hs-identifier">foldl1'</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: (Char -&gt; Char -&gt; Char) -&gt; ByteString -&gt; Char</span><span>
</span><span id="line-81"></span><span>
</span><span id="line-82"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#foldr"><span class="hs-identifier">foldr</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: (Char -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a</span><span>
</span><span id="line-83"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#foldr%27"><span class="hs-identifier">foldr'</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: (Char -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a</span><span>
</span><span id="line-84"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#foldr1"><span class="hs-identifier">foldr1</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: (Char -&gt; Char -&gt; Char) -&gt; ByteString -&gt; Char</span><span>
</span><span id="line-85"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#foldr1%27"><span class="hs-identifier">foldr1'</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: (Char -&gt; Char -&gt; Char) -&gt; ByteString -&gt; Char</span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Special folds</span></span><span>
</span><span id="line-88"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#concat"><span class="hs-identifier">concat</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: [ByteString] -&gt; ByteString</span><span>
</span><span id="line-89"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#concatMap"><span class="hs-identifier">concatMap</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (Char -&gt; ByteString) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-90"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#any"><span class="hs-identifier">any</span></a></span><span class="hs-special">,</span><span>                    </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; Bool</span><span>
</span><span id="line-91"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#all"><span class="hs-identifier">all</span></a></span><span class="hs-special">,</span><span>                    </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; Bool</span><span>
</span><span id="line-92"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#maximum"><span class="hs-identifier">maximum</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: ByteString -&gt; Char</span><span>
</span><span id="line-93"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#minimum"><span class="hs-identifier">minimum</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: ByteString -&gt; Char</span><span>
</span><span id="line-94"></span><span>
</span><span id="line-95"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Building ByteStrings</span></span><span>
</span><span id="line-96"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Scans</span></span><span>
</span><span id="line-97"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#scanl"><span class="hs-identifier">scanl</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: (Char -&gt; Char -&gt; Char) -&gt; Char -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-98"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#scanl1"><span class="hs-identifier">scanl1</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: (Char -&gt; Char -&gt; Char) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-99"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#scanr"><span class="hs-identifier">scanr</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: (Char -&gt; Char -&gt; Char) -&gt; Char -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-100"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#scanr1"><span class="hs-identifier">scanr1</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: (Char -&gt; Char -&gt; Char) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-101"></span><span>
</span><span id="line-102"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Accumulating maps</span></span><span>
</span><span id="line-103"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#mapAccumL"><span class="hs-identifier">mapAccumL</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (acc -&gt; Char -&gt; (acc, Char)) -&gt; acc -&gt; ByteString -&gt; (acc, ByteString)</span><span>
</span><span id="line-104"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#mapAccumR"><span class="hs-identifier">mapAccumR</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (acc -&gt; Char -&gt; (acc, Char)) -&gt; acc -&gt; ByteString -&gt; (acc, ByteString)</span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Generating and unfolding ByteStrings</span></span><span>
</span><span id="line-107"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#replicate"><span class="hs-identifier">replicate</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: Int -&gt; Char -&gt; ByteString</span><span>
</span><span id="line-108"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#unfoldr"><span class="hs-identifier">unfoldr</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: (a -&gt; Maybe (Char, a)) -&gt; a -&gt; ByteString</span><span>
</span><span id="line-109"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#unfoldrN"><span class="hs-identifier">unfoldrN</span></a></span><span class="hs-special">,</span><span>               </span><span class="hs-comment">-- :: Int -&gt; (a -&gt; Maybe (Char, a)) -&gt; a -&gt; (ByteString, Maybe a)</span><span>
</span><span id="line-110"></span><span>
</span><span id="line-111"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Substrings</span></span><span>
</span><span id="line-112"></span><span>
</span><span id="line-113"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Breaking strings</span></span><span>
</span><span id="line-114"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#take"><span class="hs-identifier">take</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: Int -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-115"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#drop"><span class="hs-identifier">drop</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: Int -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-116"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#splitAt"><span class="hs-identifier">splitAt</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: Int -&gt; ByteString -&gt; (ByteString, ByteString)</span><span>
</span><span id="line-117"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#takeWhile"><span class="hs-identifier">takeWhile</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-118"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#takeWhileEnd"><span class="hs-identifier">takeWhileEnd</span></a></span><span class="hs-special">,</span><span>           </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-119"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#dropWhile"><span class="hs-identifier">dropWhile</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-120"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#dropWhileEnd"><span class="hs-identifier">dropWhileEnd</span></a></span><span class="hs-special">,</span><span>           </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-121"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#dropSpace"><span class="hs-identifier">dropSpace</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: ByteString -&gt; ByteString</span><span>
</span><span id="line-122"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#span"><span class="hs-identifier">span</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)</span><span>
</span><span id="line-123"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#spanEnd"><span class="hs-identifier">spanEnd</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)</span><span>
</span><span id="line-124"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#break"><span class="hs-identifier">break</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)</span><span>
</span><span id="line-125"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#breakEnd"><span class="hs-identifier">breakEnd</span></a></span><span class="hs-special">,</span><span>               </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)</span><span>
</span><span id="line-126"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#group"><span class="hs-identifier">group</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: ByteString -&gt; [ByteString]</span><span>
</span><span id="line-127"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#groupBy"><span class="hs-identifier">groupBy</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: (Char -&gt; Char -&gt; Bool) -&gt; ByteString -&gt; [ByteString]</span><span>
</span><span id="line-128"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#inits"><span class="hs-identifier">inits</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: ByteString -&gt; [ByteString]</span><span>
</span><span id="line-129"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#tails"><span class="hs-identifier">tails</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: ByteString -&gt; [ByteString]</span><span>
</span><span id="line-130"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#strip"><span class="hs-identifier">strip</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: ByteString -&gt; ByteString</span><span>
</span><span id="line-131"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#stripPrefix"><span class="hs-identifier">stripPrefix</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; Maybe ByteString</span><span>
</span><span id="line-132"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#stripSuffix"><span class="hs-identifier">stripSuffix</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; Maybe ByteString</span><span>
</span><span id="line-133"></span><span>
</span><span id="line-134"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Breaking into many substrings</span></span><span>
</span><span id="line-135"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#split"><span class="hs-identifier">split</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: Char -&gt; ByteString -&gt; [ByteString]</span><span>
</span><span id="line-136"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#splitWith"><span class="hs-identifier">splitWith</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; [ByteString]</span><span>
</span><span id="line-137"></span><span>
</span><span id="line-138"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Breaking into lines and words</span></span><span>
</span><span id="line-139"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#lines"><span class="hs-identifier">lines</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: ByteString -&gt; [ByteString]</span><span>
</span><span id="line-140"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#words"><span class="hs-identifier">words</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: ByteString -&gt; [ByteString]</span><span>
</span><span id="line-141"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#unlines"><span class="hs-identifier">unlines</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: [ByteString] -&gt; ByteString</span><span>
</span><span id="line-142"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#unwords"><span class="hs-identifier">unwords</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: [ByteString] -&gt; ByteString</span><span>
</span><span id="line-143"></span><span>
</span><span id="line-144"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Predicates</span></span><span>
</span><span id="line-145"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#isPrefixOf"><span class="hs-identifier">isPrefixOf</span></a></span><span class="hs-special">,</span><span>             </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; Bool</span><span>
</span><span id="line-146"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#isSuffixOf"><span class="hs-identifier">isSuffixOf</span></a></span><span class="hs-special">,</span><span>             </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; Bool</span><span>
</span><span id="line-147"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#isInfixOf"><span class="hs-identifier">isInfixOf</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; Bool</span><span>
</span><span id="line-148"></span><span>
</span><span id="line-149"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Search for arbitrary substrings</span></span><span>
</span><span id="line-150"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#breakSubstring"><span class="hs-identifier">breakSubstring</span></a></span><span class="hs-special">,</span><span>         </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; (ByteString,ByteString)</span><span>
</span><span id="line-151"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#findSubstring"><span class="hs-identifier">findSubstring</span></a></span><span class="hs-special">,</span><span>          </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; Maybe Int</span><span>
</span><span id="line-152"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#findSubstrings"><span class="hs-identifier">findSubstrings</span></a></span><span class="hs-special">,</span><span>         </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; [Int]</span><span>
</span><span id="line-153"></span><span>
</span><span id="line-154"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Searching ByteStrings</span></span><span>
</span><span id="line-155"></span><span>
</span><span id="line-156"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Searching by equality</span></span><span>
</span><span id="line-157"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#elem"><span class="hs-identifier">elem</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: Char -&gt; ByteString -&gt; Bool</span><span>
</span><span id="line-158"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#notElem"><span class="hs-identifier">notElem</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: Char -&gt; ByteString -&gt; Bool</span><span>
</span><span id="line-159"></span><span>
</span><span id="line-160"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Searching with a predicate</span></span><span>
</span><span id="line-161"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#find"><span class="hs-identifier">find</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; Maybe Char</span><span>
</span><span id="line-162"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#filter"><span class="hs-identifier">filter</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; ByteString</span><span>
</span><span id="line-163"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#partition"><span class="hs-identifier">partition</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)</span><span>
</span><span id="line-164"></span><span>
</span><span id="line-165"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Indexing ByteStrings</span></span><span>
</span><span id="line-166"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#index"><span class="hs-identifier">index</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: ByteString -&gt; Int -&gt; Char</span><span>
</span><span id="line-167"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#elemIndex"><span class="hs-identifier">elemIndex</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: Char -&gt; ByteString -&gt; Maybe Int</span><span>
</span><span id="line-168"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#elemIndices"><span class="hs-identifier">elemIndices</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: Char -&gt; ByteString -&gt; [Int]</span><span>
</span><span id="line-169"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#elemIndexEnd"><span class="hs-identifier">elemIndexEnd</span></a></span><span class="hs-special">,</span><span>           </span><span class="hs-comment">-- :: Char -&gt; ByteString -&gt; Maybe Int</span><span>
</span><span id="line-170"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#findIndex"><span class="hs-identifier">findIndex</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; Maybe Int</span><span>
</span><span id="line-171"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#findIndices"><span class="hs-identifier">findIndices</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: (Char -&gt; Bool) -&gt; ByteString -&gt; [Int]</span><span>
</span><span id="line-172"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#count"><span class="hs-identifier">count</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: Char -&gt; ByteString -&gt; Int</span><span>
</span><span id="line-173"></span><span>
</span><span id="line-174"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Zipping and unzipping ByteStrings</span></span><span>
</span><span id="line-175"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#zip"><span class="hs-identifier">zip</span></a></span><span class="hs-special">,</span><span>                    </span><span class="hs-comment">-- :: ByteString -&gt; ByteString -&gt; [(Char,Char)]</span><span>
</span><span id="line-176"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#zipWith"><span class="hs-identifier">zipWith</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: (Char -&gt; Char -&gt; c) -&gt; ByteString -&gt; ByteString -&gt; [c]</span><span>
</span><span id="line-177"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#unzip"><span class="hs-identifier">unzip</span></a></span><span class="hs-special">,</span><span>                  </span><span class="hs-comment">-- :: [(Char,Char)] -&gt; (ByteString,ByteString)</span><span>
</span><span id="line-178"></span><span>
</span><span id="line-179"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Ordered ByteStrings</span></span><span>
</span><span id="line-180"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#sort"><span class="hs-identifier">sort</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: ByteString -&gt; ByteString</span><span>
</span><span id="line-181"></span><span>
</span><span id="line-182"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Reading from ByteStrings</span></span><span>
</span><span id="line-183"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#readInt"><span class="hs-identifier">readInt</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: ByteString -&gt; Maybe (Int, ByteString)</span><span>
</span><span id="line-184"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#readInteger"><span class="hs-identifier">readInteger</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: ByteString -&gt; Maybe (Integer, ByteString)</span><span>
</span><span id="line-185"></span><span>
</span><span id="line-186"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Low level CString conversions</span></span><span>
</span><span id="line-187"></span><span>
</span><span id="line-188"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Copying ByteStrings</span></span><span>
</span><span id="line-189"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#copy"><span class="hs-identifier">copy</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: ByteString -&gt; ByteString</span><span>
</span><span id="line-190"></span><span>
</span><span id="line-191"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Packing CStrings and pointers</span></span><span>
</span><span id="line-192"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#packCString"><span class="hs-identifier">packCString</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: CString -&gt; IO ByteString</span><span>
</span><span id="line-193"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#packCStringLen"><span class="hs-identifier">packCStringLen</span></a></span><span class="hs-special">,</span><span>         </span><span class="hs-comment">-- :: CStringLen -&gt; IO ByteString</span><span>
</span><span id="line-194"></span><span>
</span><span id="line-195"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Using ByteStrings as CStrings</span></span><span>
</span><span id="line-196"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#useAsCString"><span class="hs-identifier">useAsCString</span></a></span><span class="hs-special">,</span><span>           </span><span class="hs-comment">-- :: ByteString -&gt; (CString    -&gt; IO a) -&gt; IO a</span><span>
</span><span id="line-197"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#useAsCStringLen"><span class="hs-identifier">useAsCStringLen</span></a></span><span class="hs-special">,</span><span>        </span><span class="hs-comment">-- :: ByteString -&gt; (CStringLen -&gt; IO a) -&gt; IO a</span><span>
</span><span id="line-198"></span><span>
</span><span id="line-199"></span><span>        </span><span class="annot"><span class="hs-comment">-- * I\/O with 'ByteString's</span></span><span>
</span><span id="line-200"></span><span>        </span><span class="hs-comment">-- | ByteString I/O uses binary mode, without any character decoding</span><span>
</span><span id="line-201"></span><span>        </span><span class="hs-comment">-- or newline conversion. The fact that it does not respect the Handle</span><span>
</span><span id="line-202"></span><span>        </span><span class="hs-comment">-- newline mode is considered a flaw and may be changed in a future version.</span><span>
</span><span id="line-203"></span><span>
</span><span id="line-204"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Standard input and output</span></span><span>
</span><span id="line-205"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#getLine"><span class="hs-identifier">getLine</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: IO ByteString</span><span>
</span><span id="line-206"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#getContents"><span class="hs-identifier">getContents</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: IO ByteString</span><span>
</span><span id="line-207"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#putStr"><span class="hs-identifier">putStr</span></a></span><span class="hs-special">,</span><span>                 </span><span class="hs-comment">-- :: ByteString -&gt; IO ()</span><span>
</span><span id="line-208"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#putStrLn"><span class="hs-identifier">putStrLn</span></a></span><span class="hs-special">,</span><span>               </span><span class="hs-comment">-- :: ByteString -&gt; IO ()</span><span>
</span><span id="line-209"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#interact"><span class="hs-identifier">interact</span></a></span><span class="hs-special">,</span><span>               </span><span class="hs-comment">-- :: (ByteString -&gt; ByteString) -&gt; IO ()</span><span>
</span><span id="line-210"></span><span>
</span><span id="line-211"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Files</span></span><span>
</span><span id="line-212"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#readFile"><span class="hs-identifier">readFile</span></a></span><span class="hs-special">,</span><span>               </span><span class="hs-comment">-- :: FilePath -&gt; IO ByteString</span><span>
</span><span id="line-213"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#writeFile"><span class="hs-identifier">writeFile</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: FilePath -&gt; ByteString -&gt; IO ()</span><span>
</span><span id="line-214"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#appendFile"><span class="hs-identifier">appendFile</span></a></span><span class="hs-special">,</span><span>             </span><span class="hs-comment">-- :: FilePath -&gt; ByteString -&gt; IO ()</span><span>
</span><span id="line-215"></span><span class="hs-comment">--      mmapFile,               -- :: FilePath -&gt; IO ByteString</span><span>
</span><span id="line-216"></span><span>
</span><span id="line-217"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** I\/O with Handles</span></span><span>
</span><span id="line-218"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#hGetLine"><span class="hs-identifier">hGetLine</span></a></span><span class="hs-special">,</span><span>               </span><span class="hs-comment">-- :: Handle -&gt; IO ByteString</span><span>
</span><span id="line-219"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#hGetContents"><span class="hs-identifier">hGetContents</span></a></span><span class="hs-special">,</span><span>           </span><span class="hs-comment">-- :: Handle -&gt; IO ByteString</span><span>
</span><span id="line-220"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#hGet"><span class="hs-identifier">hGet</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: Handle -&gt; Int -&gt; IO ByteString</span><span>
</span><span id="line-221"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#hGetSome"><span class="hs-identifier">hGetSome</span></a></span><span class="hs-special">,</span><span>               </span><span class="hs-comment">-- :: Handle -&gt; Int -&gt; IO ByteString</span><span>
</span><span id="line-222"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#hGetNonBlocking"><span class="hs-identifier">hGetNonBlocking</span></a></span><span class="hs-special">,</span><span>        </span><span class="hs-comment">-- :: Handle -&gt; Int -&gt; IO ByteString</span><span>
</span><span id="line-223"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#hPut"><span class="hs-identifier">hPut</span></a></span><span class="hs-special">,</span><span>                   </span><span class="hs-comment">-- :: Handle -&gt; ByteString -&gt; IO ()</span><span>
</span><span id="line-224"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#hPutNonBlocking"><span class="hs-identifier">hPutNonBlocking</span></a></span><span class="hs-special">,</span><span>        </span><span class="hs-comment">-- :: Handle -&gt; ByteString -&gt; IO ByteString</span><span>
</span><span id="line-225"></span><span>        </span><span class="annot"><a href="Data.ByteString.html#hPutStr"><span class="hs-identifier">hPutStr</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- :: Handle -&gt; ByteString -&gt; IO ()</span><span>
</span><span id="line-226"></span><span>        </span><span class="annot"><a href="Data.ByteString.Char8.html#hPutStrLn"><span class="hs-identifier">hPutStrLn</span></a></span><span class="hs-special">,</span><span>              </span><span class="hs-comment">-- :: Handle -&gt; ByteString -&gt; IO ()</span><span>
</span><span id="line-227"></span><span>
</span><span id="line-228"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-229"></span><span>
</span><span id="line-230"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">P</span></span><span>
</span><span id="line-231"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-keyword">hiding</span><span>           </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier">reverse</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#head"><span class="hs-identifier">head</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#tail"><span class="hs-identifier">tail</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#last"><span class="hs-identifier">last</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#init"><span class="hs-identifier">init</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier">null</span></a></span><span>
</span><span id="line-232"></span><span>                                </span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier">length</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier">map</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.OldList.html#lines"><span class="hs-identifier">lines</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldl"><span class="hs-identifier">foldl</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier">foldr</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.OldList.html#unlines"><span class="hs-identifier">unlines</span></a></span><span>
</span><span id="line-233"></span><span>                                </span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier">concat</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier">any</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#take"><span class="hs-identifier">take</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#drop"><span class="hs-identifier">drop</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#splitAt"><span class="hs-identifier">splitAt</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#takeWhile"><span class="hs-identifier">takeWhile</span></a></span><span>
</span><span id="line-234"></span><span>                                </span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#dropWhile"><span class="hs-identifier">dropWhile</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#span"><span class="hs-identifier">span</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#break"><span class="hs-identifier">break</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-identifier">elem</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier">filter</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.OldList.html#unwords"><span class="hs-identifier">unwords</span></a></span><span>
</span><span id="line-235"></span><span>                                </span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.OldList.html#words"><span class="hs-identifier">words</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#maximum"><span class="hs-identifier">maximum</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#minimum"><span class="hs-identifier">minimum</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier">all</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier">concatMap</span></a></span><span>
</span><span id="line-236"></span><span>                                </span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#scanl"><span class="hs-identifier">scanl</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#scanl1"><span class="hs-identifier">scanl1</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#scanr"><span class="hs-identifier">scanr</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#scanr1"><span class="hs-identifier">scanr1</span></a></span><span>
</span><span id="line-237"></span><span>                                </span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#appendFile"><span class="hs-identifier">appendFile</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#readFile"><span class="hs-identifier">readFile</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#writeFile"><span class="hs-identifier">writeFile</span></a></span><span>
</span><span id="line-238"></span><span>                                </span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldl1"><span class="hs-identifier">foldl1</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldr1"><span class="hs-identifier">foldr1</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#replicate"><span class="hs-identifier">replicate</span></a></span><span>
</span><span id="line-239"></span><span>                                </span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#getContents"><span class="hs-identifier">getContents</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#getLine"><span class="hs-identifier">getLine</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#putStr"><span class="hs-identifier">putStr</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#putStrLn"><span class="hs-identifier">putStrLn</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/System.IO.html#interact"><span class="hs-identifier">interact</span></a></span><span>
</span><span id="line-240"></span><span>                                </span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier">zip</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier">zipWith</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#unzip"><span class="hs-identifier">unzip</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#notElem"><span class="hs-identifier">notElem</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-241"></span><span>
</span><span id="line-242"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.ByteString.html"><span class="hs-identifier">Data.ByteString</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">B</span></span><span>
</span><span id="line-243"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html"><span class="hs-identifier">Data.ByteString.Internal</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">B</span></span><span>
</span><span id="line-244"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.ByteString.Unsafe.html"><span class="hs-identifier">Data.ByteString.Unsafe</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">B</span></span><span>
</span><span id="line-245"></span><span>
</span><span id="line-246"></span><span class="hs-comment">-- Listy functions transparently exported</span><span>
</span><span id="line-247"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.ByteString.html"><span class="hs-identifier">Data.ByteString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.html#empty"><span class="hs-identifier">empty</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#null"><span class="hs-identifier">null</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#length"><span class="hs-identifier">length</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#tail"><span class="hs-identifier">tail</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#init"><span class="hs-identifier">init</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#append"><span class="hs-identifier">append</span></a></span><span>
</span><span id="line-248"></span><span>                       </span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#inits"><span class="hs-identifier">inits</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#tails"><span class="hs-identifier">tails</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#reverse"><span class="hs-identifier">reverse</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#transpose"><span class="hs-identifier">transpose</span></a></span><span>
</span><span id="line-249"></span><span>                       </span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#concat"><span class="hs-identifier">concat</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#take"><span class="hs-identifier">take</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#drop"><span class="hs-identifier">drop</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#splitAt"><span class="hs-identifier">splitAt</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#intercalate"><span class="hs-identifier">intercalate</span></a></span><span>
</span><span id="line-250"></span><span>                       </span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#sort"><span class="hs-identifier">sort</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#isPrefixOf"><span class="hs-identifier">isPrefixOf</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#isSuffixOf"><span class="hs-identifier">isSuffixOf</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#isInfixOf"><span class="hs-identifier">isInfixOf</span></a></span><span>
</span><span id="line-251"></span><span>                       </span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#stripPrefix"><span class="hs-identifier">stripPrefix</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#stripSuffix"><span class="hs-identifier">stripSuffix</span></a></span><span>
</span><span id="line-252"></span><span>                       </span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#findSubstring"><span class="hs-identifier">findSubstring</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#findSubstrings"><span class="hs-identifier">findSubstrings</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#breakSubstring"><span class="hs-identifier">breakSubstring</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#copy"><span class="hs-identifier">copy</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#group"><span class="hs-identifier">group</span></a></span><span>
</span><span id="line-253"></span><span>
</span><span id="line-254"></span><span>                       </span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#getLine"><span class="hs-identifier">getLine</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.html#getContents"><span class="hs-identifier">getContents</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.html#putStr"><span class="hs-identifier">putStr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.html#interact"><span class="hs-identifier">interact</span></a></span><span>
</span><span id="line-255"></span><span>                       </span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#readFile"><span class="hs-identifier">readFile</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.html#writeFile"><span class="hs-identifier">writeFile</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.html#appendFile"><span class="hs-identifier">appendFile</span></a></span><span>
</span><span id="line-256"></span><span>                       </span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#hGetContents"><span class="hs-identifier">hGetContents</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.html#hGet"><span class="hs-identifier">hGet</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.html#hGetSome"><span class="hs-identifier">hGetSome</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.html#hPut"><span class="hs-identifier">hPut</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.html#hPutStr"><span class="hs-identifier">hPutStr</span></a></span><span>
</span><span id="line-257"></span><span>                       </span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#hGetLine"><span class="hs-identifier">hGetLine</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.html#hGetNonBlocking"><span class="hs-identifier">hGetNonBlocking</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.html#hPutNonBlocking"><span class="hs-identifier">hPutNonBlocking</span></a></span><span>
</span><span id="line-258"></span><span>                       </span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#packCString"><span class="hs-identifier">packCString</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#packCStringLen"><span class="hs-identifier">packCStringLen</span></a></span><span>
</span><span id="line-259"></span><span>                       </span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#useAsCString"><span class="hs-identifier">useAsCString</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.html#useAsCStringLen"><span class="hs-identifier">useAsCStringLen</span></a></span><span>
</span><span id="line-260"></span><span>                       </span><span class="hs-special">)</span><span>
</span><span id="line-261"></span><span>
</span><span id="line-262"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html"><span class="hs-identifier">Data.ByteString.Internal</span></a></span><span>
</span><span id="line-263"></span><span>
</span><span id="line-264"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Char.html#"><span class="hs-identifier">Data.Char</span></a></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier">isSpace</span></a></span><span> </span><span class="hs-special">)</span><span class="hs-cpp">
#if MIN_VERSION_base(4,9,0)
</span><span class="hs-comment">-- See bytestring #70</span><span>
</span><span id="line-267"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.Char.html#"><span class="hs-identifier">GHC.Char</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#eqChar"><span class="hs-identifier">eqChar</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">List</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.OldList.html#intersperse"><span class="hs-identifier">intersperse</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-270"></span><span>
</span><span id="line-271"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.html#"><span class="hs-identifier">System.IO</span></a></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier">Handle</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.IO.StdHandles.html#stdout"><span class="hs-identifier">stdout</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-272"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.html#"><span class="hs-identifier">Foreign</span></a></span><span>
</span><span id="line-273"></span><span>
</span><span id="line-274"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-275"></span><span>
</span><span id="line-276"></span><span class="hs-comment">-- | /O(1)/ Convert a 'Char' into a 'ByteString'</span><span>
</span><span id="line-277"></span><span class="annot"><a href="Data.ByteString.Char8.html#singleton"><span class="hs-identifier hs-type">singleton</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-278"></span><span id="singleton"><span class="annot"><span class="annottext">singleton :: Char -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#singleton"><span class="hs-identifier hs-var hs-var">singleton</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; ByteString
</span><a href="Data.ByteString.html#singleton"><span class="hs-identifier hs-var">B.singleton</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; ByteString) -&gt; (Char -&gt; Word8) -&gt; Char -&gt; ByteString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span>
</span><span id="line-279"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#singleton"><span class="hs-pragma hs-type">singleton</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-280"></span><span>
</span><span id="line-281"></span><span class="hs-comment">-- | /O(n)/ Convert a 'String' into a 'ByteString'</span><span>
</span><span id="line-282"></span><span class="hs-comment">--</span><span>
</span><span id="line-283"></span><span class="hs-comment">-- For applications with large numbers of string literals, pack can be a</span><span>
</span><span id="line-284"></span><span class="hs-comment">-- bottleneck.</span><span>
</span><span id="line-285"></span><span class="annot"><a href="Data.ByteString.Char8.html#pack"><span class="hs-identifier hs-type">pack</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-286"></span><span id="pack"><span class="annot"><span class="annottext">pack :: String -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#pack"><span class="hs-identifier hs-var hs-var">pack</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; ByteString
</span><a href="Data.ByteString.Internal.html#packChars"><span class="hs-identifier hs-var">packChars</span></a></span><span>
</span><span id="line-287"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#pack"><span class="hs-pragma hs-type">pack</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-288"></span><span>
</span><span id="line-289"></span><span class="hs-comment">-- | /O(n)/ Converts a 'ByteString' to a 'String'.</span><span>
</span><span id="line-290"></span><span class="annot"><a href="Data.ByteString.Char8.html#unpack"><span class="hs-identifier hs-type">unpack</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-291"></span><span id="unpack"><span class="annot"><span class="annottext">unpack :: ByteString -&gt; String
</span><a href="Data.ByteString.Char8.html#unpack"><span class="hs-identifier hs-var hs-var">unpack</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; String
</span><a href="Data.ByteString.Internal.html#unpackChars"><span class="hs-identifier hs-var">B.unpackChars</span></a></span><span>
</span><span id="line-292"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#unpack"><span class="hs-pragma hs-type">unpack</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-293"></span><span>
</span><span id="line-294"></span><span class="hs-keyword">infixr</span><span> </span><span class="hs-number">5</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#cons"><span class="hs-operator hs-type">`cons`</span></a></span><span> </span><span class="hs-comment">--same as list (:)</span><span>
</span><span id="line-295"></span><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">5</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#snoc"><span class="hs-operator hs-type">`snoc`</span></a></span><span>
</span><span id="line-296"></span><span>
</span><span id="line-297"></span><span class="hs-comment">-- | /O(n)/ 'cons' is analogous to (:) for lists, but of different</span><span>
</span><span id="line-298"></span><span class="hs-comment">-- complexity, as it requires a memcpy.</span><span>
</span><span id="line-299"></span><span class="annot"><a href="Data.ByteString.Char8.html#cons"><span class="hs-identifier hs-type">cons</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-300"></span><span id="cons"><span class="annot"><span class="annottext">cons :: Char -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#cons"><span class="hs-identifier hs-var hs-var">cons</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#cons"><span class="hs-identifier hs-var">B.cons</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; ByteString -&gt; ByteString)
-&gt; (Char -&gt; Word8) -&gt; Char -&gt; ByteString -&gt; ByteString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span>
</span><span id="line-301"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#cons"><span class="hs-pragma hs-type">cons</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-302"></span><span>
</span><span id="line-303"></span><span class="hs-comment">-- | /O(n)/ Append a Char to the end of a 'ByteString'. Similar to</span><span>
</span><span id="line-304"></span><span class="hs-comment">-- 'cons', this function performs a memcpy.</span><span>
</span><span id="line-305"></span><span class="annot"><a href="Data.ByteString.Char8.html#snoc"><span class="hs-identifier hs-type">snoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-306"></span><span id="snoc"><span class="annot"><span class="annottext">snoc :: ByteString -&gt; Char -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#snoc"><span class="hs-identifier hs-var hs-var">snoc</span></a></span></span><span> </span><span id="local-6989586621679076783"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076783"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8 -&gt; ByteString
</span><a href="Data.ByteString.html#snoc"><span class="hs-identifier hs-var">B.snoc</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076783"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; ByteString) -&gt; (Char -&gt; Word8) -&gt; Char -&gt; ByteString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span>
</span><span id="line-307"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#snoc"><span class="hs-pragma hs-type">snoc</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-308"></span><span>
</span><span id="line-309"></span><span class="hs-comment">-- | /O(1)/ Extract the head and tail of a ByteString, returning Nothing</span><span>
</span><span id="line-310"></span><span class="hs-comment">-- if it is empty.</span><span>
</span><span id="line-311"></span><span class="annot"><a href="Data.ByteString.Char8.html#uncons"><span class="hs-identifier hs-type">uncons</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-312"></span><span id="uncons"><span class="annot"><span class="annottext">uncons :: ByteString -&gt; Maybe (Char, ByteString)
</span><a href="Data.ByteString.Char8.html#uncons"><span class="hs-identifier hs-var hs-var">uncons</span></a></span></span><span> </span><span id="local-6989586621679076781"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076781"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Maybe (Word8, ByteString)
</span><a href="Data.ByteString.html#uncons"><span class="hs-identifier hs-var">B.uncons</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076781"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-313"></span><span>                  </span><span class="annot"><span class="annottext">Maybe (Word8, ByteString)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe (Char, ByteString)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-314"></span><span>                  </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679076779"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076779"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679076778"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076778"><span class="hs-identifier hs-var">bs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Char, ByteString) -&gt; Maybe (Char, ByteString)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076779"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076778"><span class="hs-identifier hs-var">bs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-315"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#uncons"><span class="hs-pragma hs-type">uncons</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-316"></span><span>
</span><span id="line-317"></span><span class="hs-comment">-- | /O(1)/ Extract the 'init' and 'last' of a ByteString, returning Nothing</span><span>
</span><span id="line-318"></span><span class="hs-comment">-- if it is empty.</span><span>
</span><span id="line-319"></span><span class="annot"><a href="Data.ByteString.Char8.html#unsnoc"><span class="hs-identifier hs-type">unsnoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-320"></span><span id="unsnoc"><span class="annot"><span class="annottext">unsnoc :: ByteString -&gt; Maybe (ByteString, Char)
</span><a href="Data.ByteString.Char8.html#unsnoc"><span class="hs-identifier hs-var hs-var">unsnoc</span></a></span></span><span> </span><span id="local-6989586621679076776"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076776"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Maybe (ByteString, Word8)
</span><a href="Data.ByteString.html#unsnoc"><span class="hs-identifier hs-var">B.unsnoc</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076776"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-321"></span><span>                  </span><span class="annot"><span class="annottext">Maybe (ByteString, Word8)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe (ByteString, Char)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-322"></span><span>                  </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679076774"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076774"><span class="hs-identifier hs-var">bs'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679076773"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076773"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(ByteString, Char) -&gt; Maybe (ByteString, Char)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076774"><span class="hs-identifier hs-var">bs'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076773"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-323"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#unsnoc"><span class="hs-pragma hs-type">unsnoc</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-324"></span><span>
</span><span id="line-325"></span><span class="hs-comment">-- | /O(1)/ Extract the first element of a ByteString, which must be non-empty.</span><span>
</span><span id="line-326"></span><span class="annot"><a href="Data.ByteString.Char8.html#head"><span class="hs-identifier hs-type">head</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-327"></span><span id="head"><span class="annot"><span class="annottext">head :: ByteString -&gt; Char
</span><a href="Data.ByteString.Char8.html#head"><span class="hs-identifier hs-var hs-var">head</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Char) -&gt; (ByteString -&gt; Word8) -&gt; ByteString -&gt; Char
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.html#head"><span class="hs-identifier hs-var">B.head</span></a></span><span>
</span><span id="line-328"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#head"><span class="hs-pragma hs-type">head</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-329"></span><span>
</span><span id="line-330"></span><span class="hs-comment">-- | /O(1)/ Extract the last element of a packed string, which must be non-empty.</span><span>
</span><span id="line-331"></span><span class="annot"><a href="Data.ByteString.Char8.html#last"><span class="hs-identifier hs-type">last</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-332"></span><span id="last"><span class="annot"><span class="annottext">last :: ByteString -&gt; Char
</span><a href="Data.ByteString.Char8.html#last"><span class="hs-identifier hs-var hs-var">last</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Char) -&gt; (ByteString -&gt; Word8) -&gt; ByteString -&gt; Char
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.html#last"><span class="hs-identifier hs-var">B.last</span></a></span><span>
</span><span id="line-333"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#last"><span class="hs-pragma hs-type">last</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-334"></span><span>
</span><span id="line-335"></span><span class="hs-comment">-- | /O(n)/ 'map' @f xs@ is the ByteString obtained by applying @f@ to each element of @xs@</span><span>
</span><span id="line-336"></span><span class="annot"><a href="Data.ByteString.Char8.html#map"><span class="hs-identifier hs-type">map</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-337"></span><span id="map"><span class="annot"><span class="annottext">map :: (Char -&gt; Char) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#map"><span class="hs-identifier hs-var hs-var">map</span></a></span></span><span> </span><span id="local-6989586621679076770"><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="#local-6989586621679076770"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word8) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#map"><span class="hs-identifier hs-var">B.map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Word8) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Word8
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="#local-6989586621679076770"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Char
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-338"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-339"></span><span>
</span><span id="line-340"></span><span class="hs-comment">-- | /O(n)/ The 'intersperse' function takes a Char and a 'ByteString'</span><span>
</span><span id="line-341"></span><span class="hs-comment">-- and \`intersperses\' that Char between the elements of the</span><span>
</span><span id="line-342"></span><span class="hs-comment">-- 'ByteString'.  It is analogous to the intersperse function on Lists.</span><span>
</span><span id="line-343"></span><span class="annot"><a href="Data.ByteString.Char8.html#intersperse"><span class="hs-identifier hs-type">intersperse</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-344"></span><span id="intersperse"><span class="annot"><span class="annottext">intersperse :: Char -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#intersperse"><span class="hs-identifier hs-var hs-var">intersperse</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#intersperse"><span class="hs-identifier hs-var">B.intersperse</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; ByteString -&gt; ByteString)
-&gt; (Char -&gt; Word8) -&gt; Char -&gt; ByteString -&gt; ByteString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span>
</span><span id="line-345"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#intersperse"><span class="hs-pragma hs-type">intersperse</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-346"></span><span>
</span><span id="line-347"></span><span class="hs-comment">-- | 'foldl', applied to a binary operator, a starting value (typically</span><span>
</span><span id="line-348"></span><span class="hs-comment">-- the left-identity of the operator), and a ByteString, reduces the</span><span>
</span><span id="line-349"></span><span class="hs-comment">-- ByteString using the binary operator, from left to right.</span><span>
</span><span id="line-350"></span><span id="local-6989586621679077113"><span class="annot"><a href="Data.ByteString.Char8.html#foldl"><span class="hs-identifier hs-type">foldl</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679077113"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679077113"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679077113"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679077113"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-351"></span><span id="foldl"><span class="annot"><span class="annottext">foldl :: forall a. (a -&gt; Char -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Char8.html#foldl"><span class="hs-identifier hs-var hs-var">foldl</span></a></span></span><span> </span><span id="local-6989586621679076767"><span class="annot"><span class="annottext">a -&gt; Char -&gt; a
</span><a href="#local-6989586621679076767"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Word8 -&gt; a) -&gt; a -&gt; ByteString -&gt; a
forall a. (a -&gt; Word8 -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.html#foldl"><span class="hs-identifier hs-var">B.foldl</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679076765"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076765"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679076764"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076764"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Char -&gt; a
</span><a href="#local-6989586621679076767"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076765"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076764"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-352"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#foldl"><span class="hs-pragma hs-type">foldl</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-353"></span><span>
</span><span id="line-354"></span><span class="hs-comment">-- | 'foldl'' is like foldl, but strict in the accumulator.</span><span>
</span><span id="line-355"></span><span id="local-6989586621679076763"><span class="annot"><a href="Data.ByteString.Char8.html#foldl%27"><span class="hs-identifier hs-type">foldl'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679076763"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679076763"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679076763"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679076763"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-356"></span><span id="foldl%27"><span class="annot"><span class="annottext">foldl' :: forall a. (a -&gt; Char -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Char8.html#foldl%27"><span class="hs-identifier hs-var hs-var">foldl'</span></a></span></span><span> </span><span id="local-6989586621679076762"><span class="annot"><span class="annottext">a -&gt; Char -&gt; a
</span><a href="#local-6989586621679076762"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Word8 -&gt; a) -&gt; a -&gt; ByteString -&gt; a
forall a. (a -&gt; Word8 -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.html#foldl%27"><span class="hs-identifier hs-var">B.foldl'</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679076760"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076760"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679076759"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076759"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Char -&gt; a
</span><a href="#local-6989586621679076762"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076760"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076759"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-357"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#foldl%27"><span class="hs-pragma hs-type">foldl'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-358"></span><span>
</span><span id="line-359"></span><span class="hs-comment">-- | 'foldr', applied to a binary operator, a starting value</span><span>
</span><span id="line-360"></span><span class="hs-comment">-- (typically the right-identity of the operator), and a packed string,</span><span>
</span><span id="line-361"></span><span class="hs-comment">-- reduces the packed string using the binary operator, from right to left.</span><span>
</span><span id="line-362"></span><span id="local-6989586621679077109"><span class="annot"><a href="Data.ByteString.Char8.html#foldr"><span class="hs-identifier hs-type">foldr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679077109"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679077109"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679077109"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679077109"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-363"></span><span id="foldr"><span class="annot"><span class="annottext">foldr :: forall a. (Char -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Char8.html#foldr"><span class="hs-identifier hs-var hs-var">foldr</span></a></span></span><span> </span><span id="local-6989586621679076758"><span class="annot"><span class="annottext">Char -&gt; a -&gt; a
</span><a href="#local-6989586621679076758"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
forall a. (Word8 -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.html#foldr"><span class="hs-identifier hs-var">B.foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679076756"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076756"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679076755"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076755"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char -&gt; a -&gt; a
</span><a href="#local-6989586621679076758"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076756"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076755"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-364"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-365"></span><span>
</span><span id="line-366"></span><span class="hs-comment">-- | 'foldr'' is a strict variant of foldr</span><span>
</span><span id="line-367"></span><span id="local-6989586621679076754"><span class="annot"><a href="Data.ByteString.Char8.html#foldr%27"><span class="hs-identifier hs-type">foldr'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679076754"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679076754"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679076754"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679076754"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-368"></span><span id="foldr%27"><span class="annot"><span class="annottext">foldr' :: forall a. (Char -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.Char8.html#foldr%27"><span class="hs-identifier hs-var hs-var">foldr'</span></a></span></span><span> </span><span id="local-6989586621679076753"><span class="annot"><span class="annottext">Char -&gt; a -&gt; a
</span><a href="#local-6989586621679076753"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
forall a. (Word8 -&gt; a -&gt; a) -&gt; a -&gt; ByteString -&gt; a
</span><a href="Data.ByteString.html#foldr%27"><span class="hs-identifier hs-var">B.foldr'</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679076751"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076751"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679076750"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076750"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char -&gt; a -&gt; a
</span><a href="#local-6989586621679076753"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076751"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076750"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-369"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#foldr%27"><span class="hs-pragma hs-type">foldr'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-370"></span><span>
</span><span id="line-371"></span><span class="hs-comment">-- | 'foldl1' is a variant of 'foldl' that has no starting value</span><span>
</span><span id="line-372"></span><span class="hs-comment">-- argument, and thus must be applied to non-empty 'ByteString's.</span><span>
</span><span id="line-373"></span><span class="annot"><a href="Data.ByteString.Char8.html#foldl1"><span class="hs-identifier hs-type">foldl1</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-374"></span><span id="foldl1"><span class="annot"><span class="annottext">foldl1 :: (Char -&gt; Char -&gt; Char) -&gt; ByteString -&gt; Char
</span><a href="Data.ByteString.Char8.html#foldl1"><span class="hs-identifier hs-var hs-var">foldl1</span></a></span></span><span> </span><span id="local-6989586621679076749"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076749"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679076748"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076748"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Word8 -&gt; Word8 -&gt; Word8) -&gt; ByteString -&gt; Word8
</span><a href="Data.ByteString.html#foldl1"><span class="hs-identifier hs-var">B.foldl1</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679076746"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076746"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679076745"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076745"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076749"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076746"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076745"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076748"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-375"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#foldl1"><span class="hs-pragma hs-type">foldl1</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-376"></span><span>
</span><span id="line-377"></span><span class="hs-comment">-- | A strict version of 'foldl1'</span><span>
</span><span id="line-378"></span><span class="annot"><a href="Data.ByteString.Char8.html#foldl1%27"><span class="hs-identifier hs-type">foldl1'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-379"></span><span id="foldl1%27"><span class="annot"><span class="annottext">foldl1' :: (Char -&gt; Char -&gt; Char) -&gt; ByteString -&gt; Char
</span><a href="Data.ByteString.Char8.html#foldl1%27"><span class="hs-identifier hs-var hs-var">foldl1'</span></a></span></span><span> </span><span id="local-6989586621679076744"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076744"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679076743"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076743"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Word8 -&gt; Word8 -&gt; Word8) -&gt; ByteString -&gt; Word8
</span><a href="Data.ByteString.html#foldl1%27"><span class="hs-identifier hs-var">B.foldl1'</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679076741"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076741"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679076740"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076740"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076744"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076741"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076740"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076743"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-380"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#foldl1%27"><span class="hs-pragma hs-type">foldl1'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-381"></span><span>
</span><span id="line-382"></span><span class="hs-comment">-- | 'foldr1' is a variant of 'foldr' that has no starting value argument,</span><span>
</span><span id="line-383"></span><span class="hs-comment">-- and thus must be applied to non-empty 'ByteString's</span><span>
</span><span id="line-384"></span><span class="annot"><a href="Data.ByteString.Char8.html#foldr1"><span class="hs-identifier hs-type">foldr1</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-385"></span><span id="foldr1"><span class="annot"><span class="annottext">foldr1 :: (Char -&gt; Char -&gt; Char) -&gt; ByteString -&gt; Char
</span><a href="Data.ByteString.Char8.html#foldr1"><span class="hs-identifier hs-var hs-var">foldr1</span></a></span></span><span> </span><span id="local-6989586621679076739"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076739"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679076738"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076738"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Word8 -&gt; Word8 -&gt; Word8) -&gt; ByteString -&gt; Word8
</span><a href="Data.ByteString.html#foldr1"><span class="hs-identifier hs-var">B.foldr1</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679076736"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076736"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679076735"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076735"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076739"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076736"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076735"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076738"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-386"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#foldr1"><span class="hs-pragma hs-type">foldr1</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-387"></span><span>
</span><span id="line-388"></span><span class="hs-comment">-- | A strict variant of foldr1</span><span>
</span><span id="line-389"></span><span class="annot"><a href="Data.ByteString.Char8.html#foldr1%27"><span class="hs-identifier hs-type">foldr1'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-390"></span><span id="foldr1%27"><span class="annot"><span class="annottext">foldr1' :: (Char -&gt; Char -&gt; Char) -&gt; ByteString -&gt; Char
</span><a href="Data.ByteString.Char8.html#foldr1%27"><span class="hs-identifier hs-var hs-var">foldr1'</span></a></span></span><span> </span><span id="local-6989586621679076734"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076734"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679076733"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076733"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Word8 -&gt; Word8 -&gt; Word8) -&gt; ByteString -&gt; Word8
</span><a href="Data.ByteString.html#foldr1%27"><span class="hs-identifier hs-var">B.foldr1'</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679076731"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076731"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679076730"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076730"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076734"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076731"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076730"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076733"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-391"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#foldr1%27"><span class="hs-pragma hs-type">foldr1'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-392"></span><span>
</span><span id="line-393"></span><span class="hs-comment">-- | Map a function over a 'ByteString' and concatenate the results</span><span>
</span><span id="line-394"></span><span class="annot"><a href="Data.ByteString.Char8.html#concatMap"><span class="hs-identifier hs-type">concatMap</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-395"></span><span id="concatMap"><span class="annot"><span class="annottext">concatMap :: (Char -&gt; ByteString) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#concatMap"><span class="hs-identifier hs-var hs-var">concatMap</span></a></span></span><span> </span><span id="local-6989586621679076729"><span class="annot"><span class="annottext">Char -&gt; ByteString
</span><a href="#local-6989586621679076729"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; ByteString) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#concatMap"><span class="hs-identifier hs-var">B.concatMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; ByteString
</span><a href="#local-6989586621679076729"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; ByteString) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; ByteString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-396"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#concatMap"><span class="hs-pragma hs-type">concatMap</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-397"></span><span>
</span><span id="line-398"></span><span class="hs-comment">-- | Applied to a predicate and a ByteString, 'any' determines if</span><span>
</span><span id="line-399"></span><span class="hs-comment">-- any element of the 'ByteString' satisfies the predicate.</span><span>
</span><span id="line-400"></span><span class="annot"><a href="Data.ByteString.Char8.html#any"><span class="hs-identifier hs-type">any</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-401"></span><span id="any"><span class="annot"><span class="annottext">any :: (Char -&gt; Bool) -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.Char8.html#any"><span class="hs-identifier hs-var hs-var">any</span></a></span></span><span> </span><span id="local-6989586621679076727"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076727"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.html#any"><span class="hs-identifier hs-var">B.any</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076727"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-402"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#any"><span class="hs-pragma hs-type">any</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-403"></span><span>
</span><span id="line-404"></span><span class="hs-comment">-- | Applied to a predicate and a 'ByteString', 'all' determines if</span><span>
</span><span id="line-405"></span><span class="hs-comment">-- all elements of the 'ByteString' satisfy the predicate.</span><span>
</span><span id="line-406"></span><span class="annot"><a href="Data.ByteString.Char8.html#all"><span class="hs-identifier hs-type">all</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-407"></span><span id="all"><span class="annot"><span class="annottext">all :: (Char -&gt; Bool) -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.Char8.html#all"><span class="hs-identifier hs-var hs-var">all</span></a></span></span><span> </span><span id="local-6989586621679076725"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076725"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.html#all"><span class="hs-identifier hs-var">B.all</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076725"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-408"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#all"><span class="hs-pragma hs-type">all</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-409"></span><span>
</span><span id="line-410"></span><span class="hs-comment">-- | 'maximum' returns the maximum value from a 'ByteString'</span><span>
</span><span id="line-411"></span><span class="annot"><a href="Data.ByteString.Char8.html#maximum"><span class="hs-identifier hs-type">maximum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-412"></span><span id="maximum"><span class="annot"><span class="annottext">maximum :: ByteString -&gt; Char
</span><a href="Data.ByteString.Char8.html#maximum"><span class="hs-identifier hs-var hs-var">maximum</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Char) -&gt; (ByteString -&gt; Word8) -&gt; ByteString -&gt; Char
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.html#maximum"><span class="hs-identifier hs-var">B.maximum</span></a></span><span>
</span><span id="line-413"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#maximum"><span class="hs-pragma hs-type">maximum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-414"></span><span>
</span><span id="line-415"></span><span class="hs-comment">-- | 'minimum' returns the minimum value from a 'ByteString'</span><span>
</span><span id="line-416"></span><span class="annot"><a href="Data.ByteString.Char8.html#minimum"><span class="hs-identifier hs-type">minimum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-417"></span><span id="minimum"><span class="annot"><span class="annottext">minimum :: ByteString -&gt; Char
</span><a href="Data.ByteString.Char8.html#minimum"><span class="hs-identifier hs-var hs-var">minimum</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Char) -&gt; (ByteString -&gt; Word8) -&gt; ByteString -&gt; Char
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.html#minimum"><span class="hs-identifier hs-var">B.minimum</span></a></span><span>
</span><span id="line-418"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#minimum"><span class="hs-pragma hs-type">minimum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-419"></span><span>
</span><span id="line-420"></span><span class="hs-comment">-- | The 'mapAccumL' function behaves like a combination of 'map' and</span><span>
</span><span id="line-421"></span><span class="hs-comment">-- 'foldl'; it applies a function to each element of a ByteString,</span><span>
</span><span id="line-422"></span><span class="hs-comment">-- passing an accumulating parameter from left to right, and returning a</span><span>
</span><span id="line-423"></span><span class="hs-comment">-- final value of this accumulator together with the new list.</span><span>
</span><span id="line-424"></span><span id="local-6989586621679077105"><span class="annot"><a href="Data.ByteString.Char8.html#mapAccumL"><span class="hs-identifier hs-type">mapAccumL</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679077105"><span class="hs-identifier hs-type">acc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679077105"><span class="hs-identifier hs-type">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679077105"><span class="hs-identifier hs-type">acc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679077105"><span class="hs-identifier hs-type">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-425"></span><span id="mapAccumL"><span class="annot"><span class="annottext">mapAccumL :: forall acc.
(acc -&gt; Char -&gt; (acc, Char))
-&gt; acc -&gt; ByteString -&gt; (acc, ByteString)
</span><a href="Data.ByteString.Char8.html#mapAccumL"><span class="hs-identifier hs-var hs-var">mapAccumL</span></a></span></span><span> </span><span id="local-6989586621679076721"><span class="annot"><span class="annottext">acc -&gt; Char -&gt; (acc, Char)
</span><a href="#local-6989586621679076721"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(acc -&gt; Word8 -&gt; (acc, Word8))
-&gt; acc -&gt; ByteString -&gt; (acc, ByteString)
forall acc.
(acc -&gt; Word8 -&gt; (acc, Word8))
-&gt; acc -&gt; ByteString -&gt; (acc, ByteString)
</span><a href="Data.ByteString.html#mapAccumL"><span class="hs-identifier hs-var">B.mapAccumL</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679076719"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679076719"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span id="local-6989586621679076718"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076718"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">acc -&gt; Char -&gt; (acc, Char)
</span><a href="#local-6989586621679076721"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679076719"><span class="hs-identifier hs-var">acc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076718"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679076717"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679076717"><span class="hs-identifier hs-var">acc'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679076716"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076716"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679076717"><span class="hs-identifier hs-var">acc'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076716"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-426"></span><span>
</span><span id="line-427"></span><span class="hs-comment">-- | The 'mapAccumR' function behaves like a combination of 'map' and</span><span>
</span><span id="line-428"></span><span class="hs-comment">-- 'foldr'; it applies a function to each element of a ByteString,</span><span>
</span><span id="line-429"></span><span class="hs-comment">-- passing an accumulating parameter from right to left, and returning a</span><span>
</span><span id="line-430"></span><span class="hs-comment">-- final value of this accumulator together with the new ByteString.</span><span>
</span><span id="line-431"></span><span id="local-6989586621679076715"><span class="annot"><a href="Data.ByteString.Char8.html#mapAccumR"><span class="hs-identifier hs-type">mapAccumR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679076715"><span class="hs-identifier hs-type">acc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679076715"><span class="hs-identifier hs-type">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679076715"><span class="hs-identifier hs-type">acc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679076715"><span class="hs-identifier hs-type">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-432"></span><span id="mapAccumR"><span class="annot"><span class="annottext">mapAccumR :: forall acc.
(acc -&gt; Char -&gt; (acc, Char))
-&gt; acc -&gt; ByteString -&gt; (acc, ByteString)
</span><a href="Data.ByteString.Char8.html#mapAccumR"><span class="hs-identifier hs-var hs-var">mapAccumR</span></a></span></span><span> </span><span id="local-6989586621679076714"><span class="annot"><span class="annottext">acc -&gt; Char -&gt; (acc, Char)
</span><a href="#local-6989586621679076714"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(acc -&gt; Word8 -&gt; (acc, Word8))
-&gt; acc -&gt; ByteString -&gt; (acc, ByteString)
forall acc.
(acc -&gt; Word8 -&gt; (acc, Word8))
-&gt; acc -&gt; ByteString -&gt; (acc, ByteString)
</span><a href="Data.ByteString.html#mapAccumR"><span class="hs-identifier hs-var">B.mapAccumR</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679076712"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679076712"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span id="local-6989586621679076711"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076711"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">acc -&gt; Char -&gt; (acc, Char)
</span><a href="#local-6989586621679076714"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679076712"><span class="hs-identifier hs-var">acc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076711"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679076710"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679076710"><span class="hs-identifier hs-var">acc'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679076709"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076709"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621679076710"><span class="hs-identifier hs-var">acc'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076709"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-433"></span><span>
</span><span id="line-434"></span><span class="hs-comment">-- | 'scanl' is similar to 'foldl', but returns a list of successive</span><span>
</span><span id="line-435"></span><span class="hs-comment">-- reduced values from the left:</span><span>
</span><span id="line-436"></span><span class="hs-comment">--</span><span>
</span><span id="line-437"></span><span class="hs-comment">-- &gt; scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]</span><span>
</span><span id="line-438"></span><span class="hs-comment">--</span><span>
</span><span id="line-439"></span><span class="hs-comment">-- Note that</span><span>
</span><span id="line-440"></span><span class="hs-comment">--</span><span>
</span><span id="line-441"></span><span class="hs-comment">-- &gt; last (scanl f z xs) == foldl f z xs.</span><span>
</span><span id="line-442"></span><span class="annot"><a href="Data.ByteString.Char8.html#scanl"><span class="hs-identifier hs-type">scanl</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-443"></span><span id="scanl"><span class="annot"><span class="annottext">scanl :: (Char -&gt; Char -&gt; Char) -&gt; Char -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#scanl"><span class="hs-identifier hs-var hs-var">scanl</span></a></span></span><span> </span><span id="local-6989586621679076708"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076708"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679076707"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076707"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word8 -&gt; Word8) -&gt; Word8 -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#scanl"><span class="hs-identifier hs-var">B.scanl</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679076705"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076705"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679076704"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076704"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076708"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076705"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076704"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076707"><span class="hs-identifier hs-var">z</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-444"></span><span>
</span><span id="line-445"></span><span class="hs-comment">-- | 'scanl1' is a variant of 'scanl' that has no starting value argument:</span><span>
</span><span id="line-446"></span><span class="hs-comment">--</span><span>
</span><span id="line-447"></span><span class="hs-comment">-- &gt; scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]</span><span>
</span><span id="line-448"></span><span class="annot"><a href="Data.ByteString.Char8.html#scanl1"><span class="hs-identifier hs-type">scanl1</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-449"></span><span id="scanl1"><span class="annot"><span class="annottext">scanl1 :: (Char -&gt; Char -&gt; Char) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#scanl1"><span class="hs-identifier hs-var hs-var">scanl1</span></a></span></span><span> </span><span id="local-6989586621679076703"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076703"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word8 -&gt; Word8) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#scanl1"><span class="hs-identifier hs-var">B.scanl1</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679076701"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076701"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679076700"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076700"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076703"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076701"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076700"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-450"></span><span>
</span><span id="line-451"></span><span class="hs-comment">-- | scanr is the right-to-left dual of scanl.</span><span>
</span><span id="line-452"></span><span class="annot"><a href="Data.ByteString.Char8.html#scanr"><span class="hs-identifier hs-type">scanr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-453"></span><span id="scanr"><span class="annot"><span class="annottext">scanr :: (Char -&gt; Char -&gt; Char) -&gt; Char -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#scanr"><span class="hs-identifier hs-var hs-var">scanr</span></a></span></span><span> </span><span id="local-6989586621679076699"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076699"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679076698"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076698"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word8 -&gt; Word8) -&gt; Word8 -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#scanr"><span class="hs-identifier hs-var">B.scanr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679076696"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076696"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679076695"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076695"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076699"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076696"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076695"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076698"><span class="hs-identifier hs-var">z</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-454"></span><span>
</span><span id="line-455"></span><span class="hs-comment">-- | 'scanr1' is a variant of 'scanr' that has no starting value argument.</span><span>
</span><span id="line-456"></span><span class="annot"><a href="Data.ByteString.Char8.html#scanr1"><span class="hs-identifier hs-type">scanr1</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-457"></span><span id="scanr1"><span class="annot"><span class="annottext">scanr1 :: (Char -&gt; Char -&gt; Char) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#scanr1"><span class="hs-identifier hs-var hs-var">scanr1</span></a></span></span><span> </span><span id="local-6989586621679076694"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076694"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word8 -&gt; Word8) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#scanr1"><span class="hs-identifier hs-var">B.scanr1</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679076692"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076692"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679076691"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076691"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679076694"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076692"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076691"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-458"></span><span>
</span><span id="line-459"></span><span class="hs-comment">-- | /O(n)/ 'replicate' @n x@ is a ByteString of length @n@ with @x@</span><span>
</span><span id="line-460"></span><span class="hs-comment">-- the value of every element. The following holds:</span><span>
</span><span id="line-461"></span><span class="hs-comment">--</span><span>
</span><span id="line-462"></span><span class="hs-comment">-- &gt; replicate w c = unfoldr w (\u -&gt; Just (u,u)) c</span><span>
</span><span id="line-463"></span><span class="hs-comment">--</span><span>
</span><span id="line-464"></span><span class="hs-comment">-- This implemenation uses @memset(3)@</span><span>
</span><span id="line-465"></span><span class="annot"><a href="Data.ByteString.Char8.html#replicate"><span class="hs-identifier hs-type">replicate</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-466"></span><span id="replicate"><span class="annot"><span class="annottext">replicate :: Int -&gt; Char -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#replicate"><span class="hs-identifier hs-var hs-var">replicate</span></a></span></span><span> </span><span id="local-6989586621679076690"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076690"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word8 -&gt; ByteString
</span><a href="Data.ByteString.html#replicate"><span class="hs-identifier hs-var">B.replicate</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076690"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; ByteString) -&gt; (Char -&gt; Word8) -&gt; Char -&gt; ByteString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span>
</span><span id="line-467"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#replicate"><span class="hs-pragma hs-type">replicate</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-468"></span><span>
</span><span id="line-469"></span><span class="hs-comment">-- | /O(n)/, where /n/ is the length of the result.  The 'unfoldr'</span><span>
</span><span id="line-470"></span><span class="hs-comment">-- function is analogous to the List \'unfoldr\'.  'unfoldr' builds a</span><span>
</span><span id="line-471"></span><span class="hs-comment">-- ByteString from a seed value.  The function takes the element and</span><span>
</span><span id="line-472"></span><span class="hs-comment">-- returns 'Nothing' if it is done producing the ByteString or returns</span><span>
</span><span id="line-473"></span><span class="hs-comment">-- 'Just' @(a,b)@, in which case, @a@ is the next character in the string,</span><span>
</span><span id="line-474"></span><span class="hs-comment">-- and @b@ is the seed value for further production.</span><span>
</span><span id="line-475"></span><span class="hs-comment">--</span><span>
</span><span id="line-476"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-477"></span><span class="hs-comment">--</span><span>
</span><span id="line-478"></span><span class="hs-comment">-- &gt; unfoldr (\x -&gt; if x &lt;= '9' then Just (x, succ x) else Nothing) '0' == &quot;0123456789&quot;</span><span>
</span><span id="line-479"></span><span id="local-6989586621679077101"><span class="annot"><a href="Data.ByteString.Char8.html#unfoldr"><span class="hs-identifier hs-type">unfoldr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679077101"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679077101"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679077101"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span></span><span>
</span><span id="line-480"></span><span id="unfoldr"><span class="annot"><span class="annottext">unfoldr :: forall a. (a -&gt; Maybe (Char, a)) -&gt; a -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#unfoldr"><span class="hs-identifier hs-var hs-var">unfoldr</span></a></span></span><span> </span><span id="local-6989586621679076687"><span class="annot"><span class="annottext">a -&gt; Maybe (Char, a)
</span><a href="#local-6989586621679076687"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679076686"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076686"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Maybe (Word8, a)) -&gt; a -&gt; ByteString
forall a. (a -&gt; Maybe (Word8, a)) -&gt; a -&gt; ByteString
</span><a href="Data.ByteString.html#unfoldr"><span class="hs-identifier hs-var">B.unfoldr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((Char, a) -&gt; (Word8, a)) -&gt; Maybe (Char, a) -&gt; Maybe (Word8, a)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">(Char, a) -&gt; (Word8, a)
forall {b}. (Char, b) -&gt; (Word8, b)
</span><a href="#local-6989586621679076684"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe (Char, a) -&gt; Maybe (Word8, a))
-&gt; (a -&gt; Maybe (Char, a)) -&gt; a -&gt; Maybe (Word8, a)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe (Char, a)
</span><a href="#local-6989586621679076687"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076686"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-481"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679076684"><span class="annot"><span class="annottext">k :: (Char, b) -&gt; (Word8, b)
</span><a href="#local-6989586621679076684"><span class="hs-identifier hs-var hs-var">k</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679076683"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076683"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679076682"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679076682"><span class="hs-identifier hs-var">j</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076683"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679076682"><span class="hs-identifier hs-var">j</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-482"></span><span>
</span><span id="line-483"></span><span class="hs-comment">-- | /O(n)/ Like 'unfoldr', 'unfoldrN' builds a ByteString from a seed</span><span>
</span><span id="line-484"></span><span class="hs-comment">-- value.  However, the length of the result is limited by the first</span><span>
</span><span id="line-485"></span><span class="hs-comment">-- argument to 'unfoldrN'.  This function is more efficient than 'unfoldr'</span><span>
</span><span id="line-486"></span><span class="hs-comment">-- when the maximum length of the result is known.</span><span>
</span><span id="line-487"></span><span class="hs-comment">--</span><span>
</span><span id="line-488"></span><span class="hs-comment">-- The following equation relates 'unfoldrN' and 'unfoldr':</span><span>
</span><span id="line-489"></span><span class="hs-comment">--</span><span>
</span><span id="line-490"></span><span class="hs-comment">-- &gt; unfoldrN n f s == take n (unfoldr f s)</span><span>
</span><span id="line-491"></span><span id="local-6989586621679077094"><span class="annot"><a href="Data.ByteString.Char8.html#unfoldrN"><span class="hs-identifier hs-type">unfoldrN</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679077094"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679077094"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679077094"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077094"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-492"></span><span id="unfoldrN"><span class="annot"><span class="annottext">unfoldrN :: forall a.
Int -&gt; (a -&gt; Maybe (Char, a)) -&gt; a -&gt; (ByteString, Maybe a)
</span><a href="Data.ByteString.Char8.html#unfoldrN"><span class="hs-identifier hs-var hs-var">unfoldrN</span></a></span></span><span> </span><span id="local-6989586621679076680"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076680"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679076679"><span class="annot"><span class="annottext">a -&gt; Maybe (Char, a)
</span><a href="#local-6989586621679076679"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; (a -&gt; Maybe (Word8, a)) -&gt; a -&gt; (ByteString, Maybe a)
forall a.
Int -&gt; (a -&gt; Maybe (Word8, a)) -&gt; a -&gt; (ByteString, Maybe a)
</span><a href="Data.ByteString.html#unfoldrN"><span class="hs-identifier hs-var">B.unfoldrN</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076680"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char, a) -&gt; (Word8, a)
forall {b}. (Char, b) -&gt; (Word8, b)
</span><a href="#local-6989586621679076677"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">((Char, a) -&gt; (Word8, a)) -&gt; Maybe (Char, a) -&gt; Maybe (Word8, a)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-operator hs-var">`fmap`</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Maybe (Char, a) -&gt; Maybe (Word8, a))
-&gt; (a -&gt; Maybe (Char, a)) -&gt; a -&gt; Maybe (Word8, a)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe (Char, a)
</span><a href="#local-6989586621679076679"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-493"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679076677"><span class="annot"><span class="annottext">k :: (Char, b) -&gt; (Word8, b)
</span><a href="#local-6989586621679076677"><span class="hs-identifier hs-var hs-var">k</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679076676"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076676"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679076675"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679076675"><span class="hs-identifier hs-var">j</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076676"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679076675"><span class="hs-identifier hs-var">j</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-494"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#unfoldrN"><span class="hs-pragma hs-type">unfoldrN</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-495"></span><span>
</span><span id="line-496"></span><span class="hs-comment">-- | 'takeWhile', applied to a predicate @p@ and a ByteString @xs@,</span><span>
</span><span id="line-497"></span><span class="hs-comment">-- returns the longest prefix (possibly empty) of @xs@ of elements that</span><span>
</span><span id="line-498"></span><span class="hs-comment">-- satisfy @p@.</span><span>
</span><span id="line-499"></span><span class="annot"><a href="Data.ByteString.Char8.html#takeWhile"><span class="hs-identifier hs-type">takeWhile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-500"></span><span id="takeWhile"><span class="annot"><span class="annottext">takeWhile :: (Char -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#takeWhile"><span class="hs-identifier hs-var hs-var">takeWhile</span></a></span></span><span> </span><span id="local-6989586621679076674"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076674"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#takeWhile"><span class="hs-identifier hs-var">B.takeWhile</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076674"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-501"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#takeWhile"><span class="hs-pragma hs-type">takeWhile</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-502"></span><span>
</span><span id="line-503"></span><span class="hs-comment">-- | 'takeWhileEnd', applied to a predicate @p@ and a ByteString @xs@,</span><span>
</span><span id="line-504"></span><span class="hs-comment">-- returns the longest suffix (possibly empty) of @xs@ of elements that</span><span>
</span><span id="line-505"></span><span class="hs-comment">-- satisfy @p@.</span><span>
</span><span id="line-506"></span><span class="hs-comment">--</span><span>
</span><span id="line-507"></span><span class="hs-comment">-- @since 0.10.12.0</span><span>
</span><span id="line-508"></span><span class="annot"><a href="Data.ByteString.Char8.html#takeWhileEnd"><span class="hs-identifier hs-type">takeWhileEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-509"></span><span id="takeWhileEnd"><span class="annot"><span class="annottext">takeWhileEnd :: (Char -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#takeWhileEnd"><span class="hs-identifier hs-var hs-var">takeWhileEnd</span></a></span></span><span> </span><span id="local-6989586621679076672"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076672"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#takeWhileEnd"><span class="hs-identifier hs-var">B.takeWhileEnd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076672"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-510"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#takeWhileEnd"><span class="hs-pragma hs-type">takeWhileEnd</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-511"></span><span>
</span><span id="line-512"></span><span class="hs-comment">-- | 'dropWhile' @p xs@ returns the suffix remaining after 'takeWhile' @p xs@.</span><span>
</span><span id="line-513"></span><span class="annot"><a href="Data.ByteString.Char8.html#dropWhile"><span class="hs-identifier hs-type">dropWhile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-514"></span><span id="dropWhile"><span class="annot"><span class="annottext">dropWhile :: (Char -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#dropWhile"><span class="hs-identifier hs-var hs-var">dropWhile</span></a></span></span><span> </span><span id="local-6989586621679076670"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076670"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#dropWhile"><span class="hs-identifier hs-var">B.dropWhile</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076670"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-515"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#dropWhile"><span class="hs-pragma hs-type">dropWhile</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-516"></span><span>
</span><span id="line-517"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-518"></span><span class="annot"><span class="hs-pragma">&quot;ByteString specialise dropWhile isSpace -&gt; dropSpace&quot;</span></span><span>
</span><span id="line-519"></span><span>    </span><span class="annot"><a href="Data.ByteString.Char8.html#dropWhile"><span class="hs-pragma hs-type">dropWhile</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-pragma hs-type">isSpace</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#dropSpace"><span class="hs-pragma hs-type">dropSpace</span></a></span><span>
</span><span id="line-520"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-521"></span><span>
</span><span id="line-522"></span><span class="hs-comment">-- | 'dropWhile' @p xs@ returns the prefix remaining after 'takeWhileEnd' @p</span><span>
</span><span id="line-523"></span><span class="hs-comment">-- xs@.</span><span>
</span><span id="line-524"></span><span class="hs-comment">--</span><span>
</span><span id="line-525"></span><span class="hs-comment">-- @since 0.10.12.0</span><span>
</span><span id="line-526"></span><span class="annot"><a href="Data.ByteString.Char8.html#dropWhileEnd"><span class="hs-identifier hs-type">dropWhileEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-527"></span><span id="dropWhileEnd"><span class="annot"><span class="annottext">dropWhileEnd :: (Char -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#dropWhileEnd"><span class="hs-identifier hs-var hs-var">dropWhileEnd</span></a></span></span><span> </span><span id="local-6989586621679076668"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076668"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#dropWhileEnd"><span class="hs-identifier hs-var">B.dropWhileEnd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076668"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-528"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#dropWhileEnd"><span class="hs-pragma hs-type">dropWhileEnd</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-529"></span><span>
</span><span id="line-530"></span><span class="hs-comment">-- | 'break' @p@ is equivalent to @'span' ('not' . p)@.</span><span>
</span><span id="line-531"></span><span class="annot"><a href="Data.ByteString.Char8.html#break"><span class="hs-identifier hs-type">break</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-532"></span><span id="break"><span class="annot"><span class="annottext">break :: (Char -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.Char8.html#break"><span class="hs-identifier hs-var hs-var">break</span></a></span></span><span> </span><span id="local-6989586621679076666"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076666"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.html#break"><span class="hs-identifier hs-var">B.break</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076666"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-533"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#break"><span class="hs-pragma hs-type">break</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-534"></span><span>
</span><span id="line-535"></span><span class="hs-comment">-- See bytestring #70</span><span class="hs-cpp">
#if MIN_VERSION_base(4,9,0)
</span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-538"></span><span class="annot"><span class="hs-pragma">&quot;ByteString specialise break (x==)&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679076664"><span class="annot"><a href="#local-6989586621679076664"><span class="hs-pragma hs-var">x</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-539"></span><span>    </span><span class="annot"><a href="Data.ByteString.Char8.html#break"><span class="hs-pragma hs-type">break</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679076664"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="hs-pragma">`</span><span class="hs-pragma">eqChar</span><span class="hs-pragma">`</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#breakChar"><span class="hs-pragma hs-type">breakChar</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679076664"><span class="hs-pragma hs-type">x</span></a></span><span>
</span><span id="line-540"></span><span class="annot"><span class="hs-pragma">&quot;ByteString specialise break (==x)&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679076662"><span class="annot"><a href="#local-6989586621679076662"><span class="hs-pragma hs-var">x</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-541"></span><span>    </span><span class="annot"><a href="Data.ByteString.Char8.html#break"><span class="hs-pragma hs-type">break</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">`</span><span class="hs-pragma">eqChar</span><span class="hs-pragma">`</span><span> </span><span class="annot"><a href="#local-6989586621679076662"><span class="hs-pragma hs-type">x</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#breakChar"><span class="hs-pragma hs-type">breakChar</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679076662"><span class="hs-pragma hs-type">x</span></a></span><span>
</span><span id="line-542"></span><span>  </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-545"></span><span class="hs-pragma">&quot;ByteString specialise break (x==)&quot;</span><span> </span><span class="hs-pragma">forall</span><span> </span><span class="hs-pragma">x</span><span class="hs-pragma">.</span><span>
</span><span id="line-546"></span><span>    </span><span class="hs-pragma">break</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">x</span><span> </span><span class="hs-pragma">==</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">breakChar</span><span> </span><span class="hs-pragma">x</span><span>
</span><span id="line-547"></span><span class="hs-pragma">&quot;ByteString specialise break (==x)&quot;</span><span> </span><span class="hs-pragma">forall</span><span> </span><span class="hs-pragma">x</span><span class="hs-pragma">.</span><span>
</span><span id="line-548"></span><span>    </span><span class="hs-pragma">break</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">==</span><span> </span><span class="hs-pragma">x</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">breakChar</span><span> </span><span class="hs-pragma">x</span><span>
</span><span id="line-549"></span><span>  </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-552"></span><span class="hs-comment">-- INTERNAL:</span><span>
</span><span id="line-553"></span><span>
</span><span id="line-554"></span><span class="hs-comment">-- | 'breakChar' breaks its ByteString argument at the first occurence</span><span>
</span><span id="line-555"></span><span class="hs-comment">-- of the specified char. It is more efficient than 'break' as it is</span><span>
</span><span id="line-556"></span><span class="hs-comment">-- implemented with @memchr(3)@. I.e.</span><span>
</span><span id="line-557"></span><span class="hs-comment">--</span><span>
</span><span id="line-558"></span><span class="hs-comment">-- &gt; break (=='c') &quot;abcd&quot; == breakChar 'c' &quot;abcd&quot;</span><span>
</span><span id="line-559"></span><span class="hs-comment">--</span><span>
</span><span id="line-560"></span><span class="annot"><a href="Data.ByteString.Char8.html#breakChar"><span class="hs-identifier hs-type">breakChar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-561"></span><span id="breakChar"><span class="annot"><span class="annottext">breakChar :: Char -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.Char8.html#breakChar"><span class="hs-identifier hs-var hs-var">breakChar</span></a></span></span><span> </span><span id="local-6989586621679076661"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076661"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679076660"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076660"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Char -&gt; ByteString -&gt; Maybe Int
</span><a href="Data.ByteString.Char8.html#elemIndex"><span class="hs-identifier hs-var">elemIndex</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076661"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076660"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-562"></span><span>    </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076660"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-563"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679076659"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076659"><span class="hs-identifier hs-var">n</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTake"><span class="hs-identifier hs-var">B.unsafeTake</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076659"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076660"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeDrop"><span class="hs-identifier hs-var">B.unsafeDrop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076659"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076660"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-564"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#breakChar"><span class="hs-pragma hs-type">breakChar</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-565"></span><span>
</span><span id="line-566"></span><span class="hs-comment">-- | 'span' @p xs@ breaks the ByteString into two segments. It is</span><span>
</span><span id="line-567"></span><span class="hs-comment">-- equivalent to @('takeWhile' p xs, 'dropWhile' p xs)@</span><span>
</span><span id="line-568"></span><span class="annot"><a href="Data.ByteString.Char8.html#span"><span class="hs-identifier hs-type">span</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-569"></span><span id="span"><span class="annot"><span class="annottext">span :: (Char -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.Char8.html#span"><span class="hs-identifier hs-var hs-var">span</span></a></span></span><span> </span><span id="local-6989586621679076656"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076656"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.html#span"><span class="hs-identifier hs-var">B.span</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076656"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-570"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#span"><span class="hs-pragma hs-type">span</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-571"></span><span>
</span><span id="line-572"></span><span class="hs-comment">-- | 'spanEnd' behaves like 'span' but from the end of the 'ByteString'.</span><span>
</span><span id="line-573"></span><span class="hs-comment">-- We have</span><span>
</span><span id="line-574"></span><span class="hs-comment">--</span><span>
</span><span id="line-575"></span><span class="hs-comment">-- &gt; spanEnd (not.isSpace) &quot;x y z&quot; == (&quot;x y &quot;,&quot;z&quot;)</span><span>
</span><span id="line-576"></span><span class="hs-comment">--</span><span>
</span><span id="line-577"></span><span class="hs-comment">-- and</span><span>
</span><span id="line-578"></span><span class="hs-comment">--</span><span>
</span><span id="line-579"></span><span class="hs-comment">-- &gt; spanEnd (not . isSpace) ps</span><span>
</span><span id="line-580"></span><span class="hs-comment">-- &gt;    ==</span><span>
</span><span id="line-581"></span><span class="hs-comment">-- &gt; let (x,y) = span (not.isSpace) (reverse ps) in (reverse y, reverse x)</span><span>
</span><span id="line-582"></span><span class="hs-comment">--</span><span>
</span><span id="line-583"></span><span class="annot"><a href="Data.ByteString.Char8.html#spanEnd"><span class="hs-identifier hs-type">spanEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-584"></span><span id="spanEnd"><span class="annot"><span class="annottext">spanEnd :: (Char -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.Char8.html#spanEnd"><span class="hs-identifier hs-var hs-var">spanEnd</span></a></span></span><span> </span><span id="local-6989586621679076654"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076654"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.html#spanEnd"><span class="hs-identifier hs-var">B.spanEnd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076654"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-585"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#spanEnd"><span class="hs-pragma hs-type">spanEnd</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-586"></span><span>
</span><span id="line-587"></span><span class="hs-comment">-- | 'breakEnd' behaves like 'break' but from the end of the 'ByteString'</span><span>
</span><span id="line-588"></span><span class="hs-comment">--</span><span>
</span><span id="line-589"></span><span class="hs-comment">-- breakEnd p == spanEnd (not.p)</span><span>
</span><span id="line-590"></span><span class="annot"><a href="Data.ByteString.Char8.html#breakEnd"><span class="hs-identifier hs-type">breakEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-591"></span><span id="breakEnd"><span class="annot"><span class="annottext">breakEnd :: (Char -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.Char8.html#breakEnd"><span class="hs-identifier hs-var hs-var">breakEnd</span></a></span></span><span> </span><span id="local-6989586621679076652"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076652"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.html#breakEnd"><span class="hs-identifier hs-var">B.breakEnd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076652"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-592"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#breakEnd"><span class="hs-pragma hs-type">breakEnd</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-593"></span><span>
</span><span id="line-594"></span><span class="hs-comment">-- | /O(n)/ Break a 'ByteString' into pieces separated by the byte</span><span>
</span><span id="line-595"></span><span class="hs-comment">-- argument, consuming the delimiter. I.e.</span><span>
</span><span id="line-596"></span><span class="hs-comment">--</span><span>
</span><span id="line-597"></span><span class="hs-comment">-- &gt; split '\n' &quot;a\nb\nd\ne&quot; == [&quot;a&quot;,&quot;b&quot;,&quot;d&quot;,&quot;e&quot;]</span><span>
</span><span id="line-598"></span><span class="hs-comment">-- &gt; split 'a'  &quot;aXaXaXa&quot;    == [&quot;&quot;,&quot;X&quot;,&quot;X&quot;,&quot;X&quot;,&quot;&quot;]</span><span>
</span><span id="line-599"></span><span class="hs-comment">-- &gt; split 'x'  &quot;x&quot;          == [&quot;&quot;,&quot;&quot;]</span><span>
</span><span id="line-600"></span><span class="hs-comment">--</span><span>
</span><span id="line-601"></span><span class="hs-comment">-- and</span><span>
</span><span id="line-602"></span><span class="hs-comment">--</span><span>
</span><span id="line-603"></span><span class="hs-comment">-- &gt; intercalate [c] . split c == id</span><span>
</span><span id="line-604"></span><span class="hs-comment">-- &gt; split == splitWith . (==)</span><span>
</span><span id="line-605"></span><span class="hs-comment">--</span><span>
</span><span id="line-606"></span><span class="hs-comment">-- As for all splitting functions in this library, this function does</span><span>
</span><span id="line-607"></span><span class="hs-comment">-- not copy the substrings, it just constructs new 'ByteString's that</span><span>
</span><span id="line-608"></span><span class="hs-comment">-- are slices of the original.</span><span>
</span><span id="line-609"></span><span class="hs-comment">--</span><span>
</span><span id="line-610"></span><span class="annot"><a href="Data.ByteString.Char8.html#split"><span class="hs-identifier hs-type">split</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-611"></span><span id="split"><span class="annot"><span class="annottext">split :: Char -&gt; ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.Char8.html#split"><span class="hs-identifier hs-var hs-var">split</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.html#split"><span class="hs-identifier hs-var">B.split</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; ByteString -&gt; [ByteString])
-&gt; (Char -&gt; Word8) -&gt; Char -&gt; ByteString -&gt; [ByteString]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span>
</span><span id="line-612"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#split"><span class="hs-pragma hs-type">split</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-613"></span><span>
</span><span id="line-614"></span><span class="hs-comment">-- | /O(n)/ Splits a 'ByteString' into components delimited by</span><span>
</span><span id="line-615"></span><span class="hs-comment">-- separators, where the predicate returns True for a separator element.</span><span>
</span><span id="line-616"></span><span class="hs-comment">-- The resulting components do not contain the separators.  Two adjacent</span><span>
</span><span id="line-617"></span><span class="hs-comment">-- separators result in an empty component in the output.  eg.</span><span>
</span><span id="line-618"></span><span class="hs-comment">--</span><span>
</span><span id="line-619"></span><span class="hs-comment">-- &gt; splitWith (=='a') &quot;aabbaca&quot; == [&quot;&quot;,&quot;&quot;,&quot;bb&quot;,&quot;c&quot;,&quot;&quot;]</span><span>
</span><span id="line-620"></span><span class="hs-comment">--</span><span>
</span><span id="line-621"></span><span class="annot"><a href="Data.ByteString.Char8.html#splitWith"><span class="hs-identifier hs-type">splitWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-622"></span><span id="splitWith"><span class="annot"><span class="annottext">splitWith :: (Char -&gt; Bool) -&gt; ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.Char8.html#splitWith"><span class="hs-identifier hs-var hs-var">splitWith</span></a></span></span><span> </span><span id="local-6989586621679076649"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076649"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.html#splitWith"><span class="hs-identifier hs-var">B.splitWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076649"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-623"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#splitWith"><span class="hs-pragma hs-type">splitWith</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-624"></span><span class="hs-comment">-- the inline makes a big difference here.</span><span>
</span><span id="line-625"></span><span>
</span><span id="line-626"></span><span class="hs-comment">{-
-- | Like 'splitWith', except that sequences of adjacent separators are
-- treated as a single separator. eg.
--
-- &gt; tokens (=='a') &quot;aabbaca&quot; == [&quot;bb&quot;,&quot;c&quot;]
--
tokens :: (Char -&gt; Bool) -&gt; ByteString -&gt; [ByteString]
tokens f = B.tokens (f . w2c)
{-# INLINE tokens #-}
-}</span><span>
</span><span id="line-636"></span><span>
</span><span id="line-637"></span><span class="hs-comment">-- | The 'groupBy' function is the non-overloaded version of 'group'.</span><span>
</span><span id="line-638"></span><span class="annot"><a href="Data.ByteString.Char8.html#groupBy"><span class="hs-identifier hs-type">groupBy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-639"></span><span id="groupBy"><span class="annot"><span class="annottext">groupBy :: (Char -&gt; Char -&gt; Bool) -&gt; ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.Char8.html#groupBy"><span class="hs-identifier hs-var hs-var">groupBy</span></a></span></span><span> </span><span id="local-6989586621679076647"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
</span><a href="#local-6989586621679076647"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word8 -&gt; Bool) -&gt; ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.html#groupBy"><span class="hs-identifier hs-var">B.groupBy</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679076645"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076645"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679076644"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076644"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
</span><a href="#local-6989586621679076647"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076645"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076644"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-640"></span><span>
</span><span id="line-641"></span><span class="hs-comment">-- | /O(1)/ 'ByteString' index (subscript) operator, starting from 0.</span><span>
</span><span id="line-642"></span><span class="annot"><a href="Data.ByteString.Char8.html#index"><span class="hs-identifier hs-type">index</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-643"></span><span id="index"><span class="annot"><span class="annottext">index :: ByteString -&gt; Int -&gt; Char
</span><a href="Data.ByteString.Char8.html#index"><span class="hs-identifier hs-var hs-var">index</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Char) -&gt; (Int -&gt; Word8) -&gt; Int -&gt; Char
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((Int -&gt; Word8) -&gt; Int -&gt; Char)
-&gt; (ByteString -&gt; Int -&gt; Word8) -&gt; ByteString -&gt; Int -&gt; Char
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int -&gt; Word8
</span><a href="Data.ByteString.html#index"><span class="hs-identifier hs-var">B.index</span></a></span><span>
</span><span id="line-644"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#index"><span class="hs-pragma hs-type">index</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-645"></span><span>
</span><span id="line-646"></span><span class="hs-comment">-- | /O(n)/ The 'elemIndex' function returns the index of the first</span><span>
</span><span id="line-647"></span><span class="hs-comment">-- element in the given 'ByteString' which is equal (by memchr) to the</span><span>
</span><span id="line-648"></span><span class="hs-comment">-- query element, or 'Nothing' if there is no such element.</span><span>
</span><span id="line-649"></span><span class="annot"><a href="Data.ByteString.Char8.html#elemIndex"><span class="hs-identifier hs-type">elemIndex</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-650"></span><span id="elemIndex"><span class="annot"><span class="annottext">elemIndex :: Char -&gt; ByteString -&gt; Maybe Int
</span><a href="Data.ByteString.Char8.html#elemIndex"><span class="hs-identifier hs-var hs-var">elemIndex</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; Maybe Int
</span><a href="Data.ByteString.html#elemIndex"><span class="hs-identifier hs-var">B.elemIndex</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; ByteString -&gt; Maybe Int)
-&gt; (Char -&gt; Word8) -&gt; Char -&gt; ByteString -&gt; Maybe Int
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span>
</span><span id="line-651"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#elemIndex"><span class="hs-pragma hs-type">elemIndex</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-652"></span><span>
</span><span id="line-653"></span><span class="hs-comment">-- | /O(n)/ The 'elemIndexEnd' function returns the last index of the</span><span>
</span><span id="line-654"></span><span class="hs-comment">-- element in the given 'ByteString' which is equal to the query</span><span>
</span><span id="line-655"></span><span class="hs-comment">-- element, or 'Nothing' if there is no such element. The following</span><span>
</span><span id="line-656"></span><span class="hs-comment">-- holds:</span><span>
</span><span id="line-657"></span><span class="hs-comment">--</span><span>
</span><span id="line-658"></span><span class="hs-comment">-- &gt; elemIndexEnd c xs ==</span><span>
</span><span id="line-659"></span><span class="hs-comment">-- &gt; (-) (length xs - 1) `fmap` elemIndex c (reverse xs)</span><span>
</span><span id="line-660"></span><span class="hs-comment">--</span><span>
</span><span id="line-661"></span><span class="annot"><a href="Data.ByteString.Char8.html#elemIndexEnd"><span class="hs-identifier hs-type">elemIndexEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-662"></span><span id="elemIndexEnd"><span class="annot"><span class="annottext">elemIndexEnd :: Char -&gt; ByteString -&gt; Maybe Int
</span><a href="Data.ByteString.Char8.html#elemIndexEnd"><span class="hs-identifier hs-var hs-var">elemIndexEnd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; Maybe Int
</span><a href="Data.ByteString.html#elemIndexEnd"><span class="hs-identifier hs-var">B.elemIndexEnd</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; ByteString -&gt; Maybe Int)
-&gt; (Char -&gt; Word8) -&gt; Char -&gt; ByteString -&gt; Maybe Int
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span>
</span><span id="line-663"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#elemIndexEnd"><span class="hs-pragma hs-type">elemIndexEnd</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-664"></span><span>
</span><span id="line-665"></span><span class="hs-comment">-- | /O(n)/ The 'elemIndices' function extends 'elemIndex', by returning</span><span>
</span><span id="line-666"></span><span class="hs-comment">-- the indices of all elements equal to the query element, in ascending order.</span><span>
</span><span id="line-667"></span><span class="annot"><a href="Data.ByteString.Char8.html#elemIndices"><span class="hs-identifier hs-type">elemIndices</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-668"></span><span id="elemIndices"><span class="annot"><span class="annottext">elemIndices :: Char -&gt; ByteString -&gt; [Int]
</span><a href="Data.ByteString.Char8.html#elemIndices"><span class="hs-identifier hs-var hs-var">elemIndices</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; [Int]
</span><a href="Data.ByteString.html#elemIndices"><span class="hs-identifier hs-var">B.elemIndices</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; ByteString -&gt; [Int])
-&gt; (Char -&gt; Word8) -&gt; Char -&gt; ByteString -&gt; [Int]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span>
</span><span id="line-669"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#elemIndices"><span class="hs-pragma hs-type">elemIndices</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-670"></span><span>
</span><span id="line-671"></span><span class="hs-comment">-- | The 'findIndex' function takes a predicate and a 'ByteString' and</span><span>
</span><span id="line-672"></span><span class="hs-comment">-- returns the index of the first element in the ByteString satisfying the predicate.</span><span>
</span><span id="line-673"></span><span class="annot"><a href="Data.ByteString.Char8.html#findIndex"><span class="hs-identifier hs-type">findIndex</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-674"></span><span id="findIndex"><span class="annot"><span class="annottext">findIndex :: (Char -&gt; Bool) -&gt; ByteString -&gt; Maybe Int
</span><a href="Data.ByteString.Char8.html#findIndex"><span class="hs-identifier hs-var hs-var">findIndex</span></a></span></span><span> </span><span id="local-6989586621679076639"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076639"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; Maybe Int
</span><a href="Data.ByteString.html#findIndex"><span class="hs-identifier hs-var">B.findIndex</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076639"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-675"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#findIndex"><span class="hs-pragma hs-type">findIndex</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-676"></span><span>
</span><span id="line-677"></span><span class="hs-comment">-- | The 'findIndices' function extends 'findIndex', by returning the</span><span>
</span><span id="line-678"></span><span class="hs-comment">-- indices of all elements satisfying the predicate, in ascending order.</span><span>
</span><span id="line-679"></span><span class="annot"><a href="Data.ByteString.Char8.html#findIndices"><span class="hs-identifier hs-type">findIndices</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-680"></span><span id="findIndices"><span class="annot"><span class="annottext">findIndices :: (Char -&gt; Bool) -&gt; ByteString -&gt; [Int]
</span><a href="Data.ByteString.Char8.html#findIndices"><span class="hs-identifier hs-var hs-var">findIndices</span></a></span></span><span> </span><span id="local-6989586621679076637"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076637"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; [Int]
</span><a href="Data.ByteString.html#findIndices"><span class="hs-identifier hs-var">B.findIndices</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076637"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-681"></span><span>
</span><span id="line-682"></span><span class="hs-comment">-- | count returns the number of times its argument appears in the ByteString</span><span>
</span><span id="line-683"></span><span class="hs-comment">--</span><span>
</span><span id="line-684"></span><span class="hs-comment">-- &gt; count = length . elemIndices</span><span>
</span><span id="line-685"></span><span class="hs-comment">--</span><span>
</span><span id="line-686"></span><span class="hs-comment">-- Also</span><span>
</span><span id="line-687"></span><span class="hs-comment">--</span><span>
</span><span id="line-688"></span><span class="hs-comment">-- &gt; count '\n' == length . lines</span><span>
</span><span id="line-689"></span><span class="hs-comment">--</span><span>
</span><span id="line-690"></span><span class="hs-comment">-- But more efficiently than using length on the intermediate list.</span><span>
</span><span id="line-691"></span><span class="annot"><a href="Data.ByteString.Char8.html#count"><span class="hs-identifier hs-type">count</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-692"></span><span id="count"><span class="annot"><span class="annottext">count :: Char -&gt; ByteString -&gt; Int
</span><a href="Data.ByteString.Char8.html#count"><span class="hs-identifier hs-var hs-var">count</span></a></span></span><span> </span><span id="local-6989586621679076635"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076635"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; Int
</span><a href="Data.ByteString.html#count"><span class="hs-identifier hs-var">B.count</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076635"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-693"></span><span>
</span><span id="line-694"></span><span class="hs-comment">-- | /O(n)/ 'elem' is the 'ByteString' membership predicate. This</span><span>
</span><span id="line-695"></span><span class="hs-comment">-- implementation uses @memchr(3)@.</span><span>
</span><span id="line-696"></span><span class="annot"><a href="Data.ByteString.Char8.html#elem"><span class="hs-identifier hs-type">elem</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-697"></span><span id="elem"><span class="annot"><span class="annottext">elem :: Char -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.Char8.html#elem"><span class="hs-identifier hs-var hs-var">elem</span></a></span></span><span>    </span><span id="local-6989586621679076633"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076633"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.html#elem"><span class="hs-identifier hs-var">B.elem</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076633"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-698"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#elem"><span class="hs-pragma hs-type">elem</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-699"></span><span>
</span><span id="line-700"></span><span class="hs-comment">-- | /O(n)/ 'notElem' is the inverse of 'elem'</span><span>
</span><span id="line-701"></span><span class="annot"><a href="Data.ByteString.Char8.html#notElem"><span class="hs-identifier hs-type">notElem</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-702"></span><span id="notElem"><span class="annot"><span class="annottext">notElem :: Char -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.Char8.html#notElem"><span class="hs-identifier hs-var hs-var">notElem</span></a></span></span><span> </span><span id="local-6989586621679076631"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076631"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; ByteString -&gt; Bool
</span><a href="Data.ByteString.html#notElem"><span class="hs-identifier hs-var">B.notElem</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Word8
</span><a href="Data.ByteString.Internal.html#c2w"><span class="hs-identifier hs-var">c2w</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679076631"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-703"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#notElem"><span class="hs-pragma hs-type">notElem</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-704"></span><span>
</span><span id="line-705"></span><span class="hs-comment">-- | /O(n)/ 'filter', applied to a predicate and a ByteString,</span><span>
</span><span id="line-706"></span><span class="hs-comment">-- returns a ByteString containing those characters that satisfy the</span><span>
</span><span id="line-707"></span><span class="hs-comment">-- predicate.</span><span>
</span><span id="line-708"></span><span class="annot"><a href="Data.ByteString.Char8.html#filter"><span class="hs-identifier hs-type">filter</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-709"></span><span id="filter"><span class="annot"><span class="annottext">filter :: (Char -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#filter"><span class="hs-identifier hs-var hs-var">filter</span></a></span></span><span> </span><span id="local-6989586621679076629"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076629"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#filter"><span class="hs-identifier hs-var">B.filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076629"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-710"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#filter"><span class="hs-pragma hs-type">filter</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-711"></span><span>
</span><span id="line-712"></span><span class="hs-comment">-- | @since 0.10.12.0</span><span>
</span><span id="line-713"></span><span class="annot"><a href="Data.ByteString.Char8.html#partition"><span class="hs-identifier hs-type">partition</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-714"></span><span id="partition"><span class="annot"><span class="annottext">partition :: (Char -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.Char8.html#partition"><span class="hs-identifier hs-var hs-var">partition</span></a></span></span><span> </span><span id="local-6989586621679076627"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076627"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.html#partition"><span class="hs-identifier hs-var">B.partition</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076627"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-715"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#partition"><span class="hs-pragma hs-type">partition</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-716"></span><span>
</span><span id="line-717"></span><span class="hs-comment">{-
-- | /O(n)/ and /O(n\/c) space/ A first order equivalent of /filter .
-- (==)/, for the common case of filtering a single Char. It is more
-- efficient to use /filterChar/ in this case.
--
-- &gt; filterChar == filter . (==)
--
-- filterChar is around 10x faster, and uses much less space, than its
-- filter equivalent
--
filterChar :: Char -&gt; ByteString -&gt; ByteString
filterChar c ps = replicate (count c ps) c
{-# INLINE filterChar #-}

{-# RULES
&quot;ByteString specialise filter (== x)&quot; forall x.
    filter ((==) x) = filterChar x
&quot;ByteString specialise filter (== x)&quot; forall x.
    filter (== x) = filterChar x
  #-}
-}</span><span>
</span><span id="line-738"></span><span>
</span><span id="line-739"></span><span class="hs-comment">-- | /O(n)/ The 'find' function takes a predicate and a ByteString,</span><span>
</span><span id="line-740"></span><span class="hs-comment">-- and returns the first element in matching the predicate, or 'Nothing'</span><span>
</span><span id="line-741"></span><span class="hs-comment">-- if there is no such element.</span><span>
</span><span id="line-742"></span><span class="annot"><a href="Data.ByteString.Char8.html#find"><span class="hs-identifier hs-type">find</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-743"></span><span id="find"><span class="annot"><span class="annottext">find :: (Char -&gt; Bool) -&gt; ByteString -&gt; Maybe Char
</span><a href="Data.ByteString.Char8.html#find"><span class="hs-identifier hs-var hs-var">find</span></a></span></span><span> </span><span id="local-6989586621679076625"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076625"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679076624"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076624"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Char) -&gt; Maybe Word8 -&gt; Maybe Char
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-operator hs-var">`fmap`</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; Maybe Word8
</span><a href="Data.ByteString.html#find"><span class="hs-identifier hs-var">B.find</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679076625"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076624"><span class="hs-identifier hs-var">ps</span></a></span><span>
</span><span id="line-744"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#find"><span class="hs-pragma hs-type">find</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-745"></span><span>
</span><span id="line-746"></span><span class="hs-comment">{-
-- | /O(n)/ A first order equivalent of /filter . (==)/, for the common
-- case of filtering a single Char. It is more efficient to use
-- filterChar in this case.
--
-- &gt; filterChar == filter . (==)
--
-- filterChar is around 10x faster, and uses much less space, than its
-- filter equivalent
--
filterChar :: Char -&gt; ByteString -&gt; ByteString
filterChar c = B.filterByte (c2w c)
{-# INLINE filterChar #-}

-- | /O(n)/ A first order equivalent of /filter . (\/=)/, for the common
-- case of filtering a single Char out of a list. It is more efficient
-- to use /filterNotChar/ in this case.
--
-- &gt; filterNotChar == filter . (/=)
--
-- filterNotChar is around 3x faster, and uses much less space, than its
-- filter equivalent
--
filterNotChar :: Char -&gt; ByteString -&gt; ByteString
filterNotChar c = B.filterNotByte (c2w c)
{-# INLINE filterNotChar #-}
-}</span><span>
</span><span id="line-773"></span><span>
</span><span id="line-774"></span><span class="hs-comment">-- | /O(n)/ 'zip' takes two ByteStrings and returns a list of</span><span>
</span><span id="line-775"></span><span class="hs-comment">-- corresponding pairs of Chars. If one input ByteString is short,</span><span>
</span><span id="line-776"></span><span class="hs-comment">-- excess elements of the longer ByteString are discarded. This is</span><span>
</span><span id="line-777"></span><span class="hs-comment">-- equivalent to a pair of 'unpack' operations, and so space</span><span>
</span><span id="line-778"></span><span class="hs-comment">-- usage may be large for multi-megabyte ByteStrings</span><span>
</span><span id="line-779"></span><span class="annot"><a href="Data.ByteString.Char8.html#zip"><span class="hs-identifier hs-type">zip</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-780"></span><span id="zip"><span class="annot"><span class="annottext">zip :: ByteString -&gt; ByteString -&gt; [(Char, Char)]
</span><a href="Data.ByteString.Char8.html#zip"><span class="hs-identifier hs-var hs-var">zip</span></a></span></span><span> </span><span id="local-6989586621679076622"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076622"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span id="local-6989586621679076621"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076621"><span class="hs-identifier hs-var">qs</span></a></span></span><span>
</span><span id="line-781"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">B.null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076622"><span class="hs-identifier hs-var">ps</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">B.null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076621"><span class="hs-identifier hs-var">qs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-782"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Char
</span><a href="Data.ByteString.Char8.html#unsafeHead"><span class="hs-identifier hs-var">unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076622"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Char
</span><a href="Data.ByteString.Char8.html#unsafeHead"><span class="hs-identifier hs-var">unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076621"><span class="hs-identifier hs-var">qs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Char, Char) -&gt; [(Char, Char)] -&gt; [(Char, Char)]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; [(Char, Char)]
</span><a href="Data.ByteString.Char8.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">B.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076622"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">B.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076621"><span class="hs-identifier hs-var">qs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-783"></span><span>
</span><span id="line-784"></span><span class="hs-comment">-- | 'zipWith' generalises 'zip' by zipping with the function given as</span><span>
</span><span id="line-785"></span><span class="hs-comment">-- the first argument, instead of a tupling function.  For example,</span><span>
</span><span id="line-786"></span><span class="hs-comment">-- @'zipWith' (+)@ is applied to two ByteStrings to produce the list</span><span>
</span><span id="line-787"></span><span class="hs-comment">-- of corresponding sums.</span><span>
</span><span id="line-788"></span><span id="local-6989586621679077090"><span class="annot"><a href="Data.ByteString.Char8.html#zipWith"><span class="hs-identifier hs-type">zipWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679077090"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679077090"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-789"></span><span id="zipWith"><span class="annot"><span class="annottext">zipWith :: forall a. (Char -&gt; Char -&gt; a) -&gt; ByteString -&gt; ByteString -&gt; [a]
</span><a href="Data.ByteString.Char8.html#zipWith"><span class="hs-identifier hs-var hs-var">zipWith</span></a></span></span><span> </span><span id="local-6989586621679076617"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; a
</span><a href="#local-6989586621679076617"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word8 -&gt; a) -&gt; ByteString -&gt; ByteString -&gt; [a]
forall a. (Word8 -&gt; Word8 -&gt; a) -&gt; ByteString -&gt; ByteString -&gt; [a]
</span><a href="Data.ByteString.html#zipWith"><span class="hs-identifier hs-var">B.zipWith</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char -&gt; a) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((Char -&gt; a) -&gt; Word8 -&gt; a)
-&gt; (Word8 -&gt; Char -&gt; a) -&gt; Word8 -&gt; Word8 -&gt; a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; a
</span><a href="#local-6989586621679076617"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char -&gt; a) -&gt; (Word8 -&gt; Char) -&gt; Word8 -&gt; Char -&gt; a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-790"></span><span>
</span><span id="line-791"></span><span class="hs-comment">-- | 'unzip' transforms a list of pairs of Chars into a pair of</span><span>
</span><span id="line-792"></span><span class="hs-comment">-- ByteStrings. Note that this performs two 'pack' operations.</span><span>
</span><span id="line-793"></span><span class="annot"><a href="Data.ByteString.Char8.html#unzip"><span class="hs-identifier hs-type">unzip</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-794"></span><span id="unzip"><span class="annot"><span class="annottext">unzip :: [(Char, Char)] -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.Char8.html#unzip"><span class="hs-identifier hs-var hs-var">unzip</span></a></span></span><span> </span><span id="local-6989586621679076615"><span class="annot"><span class="annottext">[(Char, Char)]
</span><a href="#local-6989586621679076615"><span class="hs-identifier hs-var">ls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#pack"><span class="hs-identifier hs-var">pack</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((Char, Char) -&gt; Char) -&gt; [(Char, Char)] -&gt; String
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">P.map</span></a></span><span> </span><span class="annot"><span class="annottext">(Char, Char) -&gt; Char
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(Char, Char)]
</span><a href="#local-6989586621679076615"><span class="hs-identifier hs-var">ls</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#pack"><span class="hs-identifier hs-var">pack</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((Char, Char) -&gt; Char) -&gt; [(Char, Char)] -&gt; String
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">P.map</span></a></span><span> </span><span class="annot"><span class="annottext">(Char, Char) -&gt; Char
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">[(Char, Char)]
</span><a href="#local-6989586621679076615"><span class="hs-identifier hs-var">ls</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-795"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#unzip"><span class="hs-pragma hs-type">unzip</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-796"></span><span>
</span><span id="line-797"></span><span class="hs-comment">-- | A variety of 'head' for non-empty ByteStrings. 'unsafeHead' omits</span><span>
</span><span id="line-798"></span><span class="hs-comment">-- the check for the empty case, which is good for performance, but</span><span>
</span><span id="line-799"></span><span class="hs-comment">-- there is an obligation on the programmer to provide a proof that the</span><span>
</span><span id="line-800"></span><span class="hs-comment">-- ByteString is non-empty.</span><span>
</span><span id="line-801"></span><span class="annot"><a href="Data.ByteString.Char8.html#unsafeHead"><span class="hs-identifier hs-type">unsafeHead</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-802"></span><span id="unsafeHead"><span class="annot"><span class="annottext">unsafeHead :: ByteString -&gt; Char
</span><a href="Data.ByteString.Char8.html#unsafeHead"><span class="hs-identifier hs-var hs-var">unsafeHead</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.ByteString.Internal.html#w2c"><span class="hs-identifier hs-var">w2c</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Char) -&gt; (ByteString -&gt; Word8) -&gt; ByteString -&gt; Char
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">B.unsafeHead</span></a></span><span>
</span><span id="line-803"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#unsafeHead"><span class="hs-pragma hs-type">unsafeHead</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-804"></span><span>
</span><span id="line-805"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-806"></span><span class="hs-comment">-- Things that depend on the encoding</span><span>
</span><span id="line-807"></span><span>
</span><span id="line-808"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-809"></span><span class="annot"><span class="hs-pragma">&quot;ByteString specialise break -&gt; breakSpace&quot;</span></span><span>
</span><span id="line-810"></span><span>    </span><span class="annot"><a href="Data.ByteString.Char8.html#break"><span class="hs-pragma hs-type">break</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-pragma hs-type">isSpace</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#breakSpace"><span class="hs-pragma hs-type">breakSpace</span></a></span><span>
</span><span id="line-811"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-812"></span><span>
</span><span id="line-813"></span><span class="hs-comment">-- | 'breakSpace' returns the pair of ByteStrings when the argument is</span><span>
</span><span id="line-814"></span><span class="hs-comment">-- broken at the first whitespace byte. I.e.</span><span>
</span><span id="line-815"></span><span class="hs-comment">--</span><span>
</span><span id="line-816"></span><span class="hs-comment">-- &gt; break isSpace == breakSpace</span><span>
</span><span id="line-817"></span><span class="hs-comment">--</span><span>
</span><span id="line-818"></span><span class="annot"><a href="Data.ByteString.Char8.html#breakSpace"><span class="hs-identifier hs-type">breakSpace</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-819"></span><span id="breakSpace"><span class="annot"><span class="annottext">breakSpace :: ByteString -&gt; (ByteString, ByteString)
</span><a href="Data.ByteString.Char8.html#breakSpace"><span class="hs-identifier hs-var hs-var">breakSpace</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#PS"><span class="hs-identifier hs-type">PS</span></a></span><span> </span><span id="local-6989586621679076611"><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679076611"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679076610"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076610"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679076609"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076609"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO (ByteString, ByteString) -&gt; (ByteString, ByteString)
forall a. IO a -&gt; a
</span><a href="Data.ByteString.Internal.html#accursedUnutterablePerformIO"><span class="hs-identifier hs-var">accursedUnutterablePerformIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (ByteString, ByteString) -&gt; (ByteString, ByteString))
-&gt; IO (ByteString, ByteString) -&gt; (ByteString, ByteString)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
-&gt; (Ptr Word8 -&gt; IO (ByteString, ByteString))
-&gt; IO (ByteString, ByteString)
forall a b. ForeignPtr a -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="../../base/src/GHC.ForeignPtr.html#unsafeWithForeignPtr"><span class="hs-identifier hs-var">unsafeWithForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679076611"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr Word8 -&gt; IO (ByteString, ByteString))
 -&gt; IO (ByteString, ByteString))
-&gt; (Ptr Word8 -&gt; IO (ByteString, ByteString))
-&gt; IO (ByteString, ByteString)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679076606"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679076606"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-820"></span><span>    </span><span id="local-6989586621679076605"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076605"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Int -&gt; IO Int
</span><a href="Data.ByteString.Char8.html#firstspace"><span class="hs-identifier hs-var">firstspace</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679076606"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Ptr Word8
forall a b. Ptr a -&gt; Int -&gt; Ptr b
</span><a href="../../base/src/GHC.Ptr.html#plusPtr"><span class="hs-operator hs-var">`plusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076610"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076609"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-821"></span><span>    </span><span class="annot"><span class="annottext">(ByteString, ByteString) -&gt; IO (ByteString, ByteString)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">((ByteString, ByteString) -&gt; IO (ByteString, ByteString))
-&gt; (ByteString, ByteString) -&gt; IO (ByteString, ByteString)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">()
</span><span class="hs-identifier">_</span></span><span>
</span><span id="line-822"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076605"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; Int -&gt; Int -&gt; ByteString
</span><a href="Data.ByteString.Internal.html#PS"><span class="hs-identifier hs-var">PS</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679076611"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076610"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076609"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-823"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076605"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076609"><span class="hs-identifier hs-var">l</span></a></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; Int -&gt; Int -&gt; ByteString
</span><a href="Data.ByteString.Internal.html#PS"><span class="hs-identifier hs-var">PS</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679076611"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076610"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076609"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-824"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; Int -&gt; Int -&gt; ByteString
</span><a href="Data.ByteString.Internal.html#PS"><span class="hs-identifier hs-var">PS</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679076611"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076610"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076605"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; Int -&gt; Int -&gt; ByteString
</span><a href="Data.ByteString.Internal.html#PS"><span class="hs-identifier hs-var">PS</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679076611"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076610"><span class="hs-identifier hs-var">s</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076605"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076609"><span class="hs-identifier hs-var">l</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076605"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-825"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-826"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#breakSpace"><span class="hs-pragma hs-type">breakSpace</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-827"></span><span>
</span><span id="line-828"></span><span class="annot"><a href="Data.ByteString.Char8.html#firstspace"><span class="hs-identifier hs-type">firstspace</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-829"></span><span id="firstspace"><span class="annot"><span class="annottext">firstspace :: Ptr Word8 -&gt; Int -&gt; Int -&gt; IO Int
</span><a href="Data.ByteString.Char8.html#firstspace"><span class="hs-identifier hs-var hs-var">firstspace</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679076600"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679076600"><span class="hs-identifier hs-var">ptr</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679076599"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076599"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679076598"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076598"><span class="hs-identifier hs-var">m</span></a></span></span><span>
</span><span id="line-830"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076599"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076598"><span class="hs-identifier hs-var">m</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IO Int
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076599"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-831"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621679076597"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076597"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; IO Word8
forall a b. Storable a =&gt; Ptr b -&gt; Int -&gt; IO a
</span><a href="../../base/src/Foreign.Storable.html#peekByteOff"><span class="hs-identifier hs-var">peekByteOff</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679076600"><span class="hs-identifier hs-var">ptr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076599"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-832"></span><span>                     </span><span class="hs-keyword">if</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Word8 -&gt; Bool) -&gt; Word8 -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="Data.ByteString.Internal.html#isSpaceWord8"><span class="hs-identifier hs-var">isSpaceWord8</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076597"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Int -&gt; IO Int
</span><a href="Data.ByteString.Char8.html#firstspace"><span class="hs-identifier hs-var">firstspace</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679076600"><span class="hs-identifier hs-var">ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076599"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076598"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IO Int
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076599"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-833"></span><span>
</span><span id="line-834"></span><span class="hs-comment">-- | 'dropSpace' efficiently returns the 'ByteString' argument with</span><span>
</span><span id="line-835"></span><span class="hs-comment">-- white space Chars removed from the front. It is more efficient than</span><span>
</span><span id="line-836"></span><span class="hs-comment">-- calling dropWhile for removing whitespace. I.e.</span><span>
</span><span id="line-837"></span><span class="hs-comment">--</span><span>
</span><span id="line-838"></span><span class="hs-comment">-- &gt; dropWhile isSpace == dropSpace</span><span>
</span><span id="line-839"></span><span class="hs-comment">--</span><span>
</span><span id="line-840"></span><span class="hs-comment">-- @since 0.10.12.0</span><span>
</span><span id="line-841"></span><span class="annot"><a href="Data.ByteString.Char8.html#dropSpace"><span class="hs-identifier hs-type">dropSpace</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-842"></span><span id="dropSpace"><span class="annot"><span class="annottext">dropSpace :: ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#dropSpace"><span class="hs-identifier hs-var hs-var">dropSpace</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#PS"><span class="hs-identifier hs-type">PS</span></a></span><span> </span><span id="local-6989586621679076593"><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679076593"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679076592"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076592"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679076591"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076591"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO ByteString -&gt; ByteString
forall a. IO a -&gt; a
</span><a href="Data.ByteString.Internal.html#accursedUnutterablePerformIO"><span class="hs-identifier hs-var">accursedUnutterablePerformIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO ByteString -&gt; ByteString) -&gt; IO ByteString -&gt; ByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; (Ptr Word8 -&gt; IO ByteString) -&gt; IO ByteString
forall a b. ForeignPtr a -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="../../base/src/GHC.ForeignPtr.html#unsafeWithForeignPtr"><span class="hs-identifier hs-var">unsafeWithForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679076593"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr Word8 -&gt; IO ByteString) -&gt; IO ByteString)
-&gt; (Ptr Word8 -&gt; IO ByteString) -&gt; IO ByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679076590"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679076590"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-843"></span><span>    </span><span id="local-6989586621679076589"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076589"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Int -&gt; IO Int
</span><a href="Data.ByteString.Char8.html#firstnonspace"><span class="hs-identifier hs-var">firstnonspace</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679076590"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Ptr Word8
forall a b. Ptr a -&gt; Int -&gt; Ptr b
</span><a href="../../base/src/GHC.Ptr.html#plusPtr"><span class="hs-operator hs-var">`plusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076592"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076591"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-844"></span><span>    </span><span class="annot"><span class="annottext">ByteString -&gt; IO ByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; IO ByteString) -&gt; ByteString -&gt; IO ByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076589"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076591"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; Int -&gt; Int -&gt; ByteString
</span><a href="Data.ByteString.Internal.html#PS"><span class="hs-identifier hs-var">PS</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679076593"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076592"><span class="hs-identifier hs-var">s</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076589"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076591"><span class="hs-identifier hs-var">l</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076589"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-845"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#dropSpace"><span class="hs-pragma hs-type">dropSpace</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-846"></span><span>
</span><span id="line-847"></span><span class="annot"><a href="Data.ByteString.Char8.html#firstnonspace"><span class="hs-identifier hs-type">firstnonspace</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-848"></span><span id="firstnonspace"><span class="annot"><span class="annottext">firstnonspace :: Ptr Word8 -&gt; Int -&gt; Int -&gt; IO Int
</span><a href="Data.ByteString.Char8.html#firstnonspace"><span class="hs-identifier hs-var hs-var">firstnonspace</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679076587"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679076587"><span class="hs-identifier hs-var">ptr</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679076586"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076586"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679076585"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076585"><span class="hs-identifier hs-var">m</span></a></span></span><span>
</span><span id="line-849"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076586"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076585"><span class="hs-identifier hs-var">m</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IO Int
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076586"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-850"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621679076584"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076584"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; IO Word8
forall a. Storable a =&gt; Ptr a -&gt; Int -&gt; IO a
</span><a href="../../base/src/Foreign.Storable.html#peekElemOff"><span class="hs-identifier hs-var">peekElemOff</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679076587"><span class="hs-identifier hs-var">ptr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076586"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-851"></span><span>                     </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="Data.ByteString.Internal.html#isSpaceWord8"><span class="hs-identifier hs-var">isSpaceWord8</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076584"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Int -&gt; IO Int
</span><a href="Data.ByteString.Char8.html#firstnonspace"><span class="hs-identifier hs-var">firstnonspace</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679076587"><span class="hs-identifier hs-var">ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076586"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076585"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IO Int
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076586"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-852"></span><span>
</span><span id="line-853"></span><span class="hs-comment">-- | Remove leading and trailing white space from a 'ByteString'.</span><span>
</span><span id="line-854"></span><span class="hs-comment">--</span><span>
</span><span id="line-855"></span><span class="hs-comment">-- @since 0.10.12.0</span><span>
</span><span id="line-856"></span><span class="annot"><a href="Data.ByteString.Char8.html#strip"><span class="hs-identifier hs-type">strip</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-857"></span><span id="strip"><span class="annot"><span class="annottext">strip :: ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#strip"><span class="hs-identifier hs-var hs-var">strip</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#dropWhile"><span class="hs-identifier hs-var">dropWhile</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; ByteString)
-&gt; (ByteString -&gt; ByteString) -&gt; ByteString -&gt; ByteString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#dropWhileEnd"><span class="hs-identifier hs-var">dropWhileEnd</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span>
</span><span id="line-858"></span><span>
</span><span id="line-859"></span><span class="hs-comment">{-
-- | 'dropSpaceEnd' efficiently returns the 'ByteString' argument with
-- white space removed from the end. I.e.
--
-- &gt; reverse . (dropWhile isSpace) . reverse == dropSpaceEnd
--
-- but it is more efficient than using multiple reverses.
--
dropSpaceEnd :: ByteString -&gt; ByteString
dropSpaceEnd (PS x s l) = accursedUnutterablePerformIO $ unsafeWithForeignPtr x $ \p -&gt; do
    i &lt;- lastnonspace (p `plusPtr` s) (l-1)
    return $! if i == (-1) then empty else PS x s (i+1)
{-# INLINE dropSpaceEnd #-}

lastnonspace :: Ptr Word8 -&gt; Int -&gt; IO Int
lastnonspace ptr n
    | n &lt; 0     = return n
    | otherwise = do w &lt;- peekElemOff ptr n
                     if isSpaceWord8 w then lastnonspace ptr (n-1) else return n
-}</span><span>
</span><span id="line-879"></span><span>
</span><span id="line-880"></span><span class="hs-comment">-- | 'lines' breaks a ByteString up into a list of ByteStrings at</span><span>
</span><span id="line-881"></span><span class="hs-comment">-- newline Chars (@'\\n'@). The resulting strings do not contain newlines.</span><span>
</span><span id="line-882"></span><span class="hs-comment">--</span><span>
</span><span id="line-883"></span><span class="hs-comment">-- Note that it __does not__ regard CR (@'\\r'@) as a newline character.</span><span>
</span><span id="line-884"></span><span class="hs-comment">--</span><span>
</span><span id="line-885"></span><span class="annot"><a href="Data.ByteString.Char8.html#lines"><span class="hs-identifier hs-type">lines</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-886"></span><span id="lines"><span class="annot"><span class="annottext">lines :: ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.Char8.html#lines"><span class="hs-identifier hs-var hs-var">lines</span></a></span></span><span> </span><span id="local-6989586621679076582"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076582"><span class="hs-identifier hs-var">ps</span></a></span></span><span>
</span><span id="line-887"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076582"><span class="hs-identifier hs-var">ps</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-888"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Maybe Int
</span><a href="#local-6989586621679076581"><span class="hs-identifier hs-var">search</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076582"><span class="hs-identifier hs-var">ps</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-889"></span><span>             </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076582"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-890"></span><span>             </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679076580"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076580"><span class="hs-identifier hs-var">n</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#take"><span class="hs-identifier hs-var">take</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076580"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076582"><span class="hs-identifier hs-var">ps</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.Char8.html#lines"><span class="hs-identifier hs-var">lines</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#drop"><span class="hs-identifier hs-var">drop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076580"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076582"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-891"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679076581"><span class="annot"><span class="annottext">search :: ByteString -&gt; Maybe Int
</span><a href="#local-6989586621679076581"><span class="hs-identifier hs-var hs-var">search</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; ByteString -&gt; Maybe Int
</span><a href="Data.ByteString.Char8.html#elemIndex"><span class="hs-identifier hs-var">elemIndex</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\n'</span></span><span>
</span><span id="line-892"></span><span>
</span><span id="line-893"></span><span class="hs-comment">{-
-- Just as fast, but more complex. Should be much faster, I thought.
lines :: ByteString -&gt; [ByteString]
lines (PS _ _ 0) = []
lines (PS x s l) = accursedUnutterablePerformIO $ unsafeWithForeignPtr x $ \p -&gt; do
        let ptr = p `plusPtr` s

            loop n = do
                let q = memchr (ptr `plusPtr` n) 0x0a (fromIntegral (l-n))
                if q == nullPtr
                    then return [PS x (s+n) (l-n)]
                    else do let i = q `minusPtr` ptr
                            ls &lt;- loop (i+1)
                            return $! PS x (s+n) (i-n) : ls
        loop 0
-}</span><span>
</span><span id="line-909"></span><span>
</span><span id="line-910"></span><span class="hs-comment">-- | 'unlines' is an inverse operation to 'lines'.  It joins lines,</span><span>
</span><span id="line-911"></span><span class="hs-comment">-- after appending a terminating newline to each.</span><span>
</span><span id="line-912"></span><span class="annot"><a href="Data.ByteString.Char8.html#unlines"><span class="hs-identifier hs-type">unlines</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-913"></span><span id="unlines"><span class="annot"><span class="annottext">unlines :: [ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#unlines"><span class="hs-identifier hs-var hs-var">unlines</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-914"></span><span class="annot"><a href="Data.ByteString.Char8.html#unlines"><span class="hs-identifier hs-var">unlines</span></a></span><span> </span><span id="local-6989586621679076579"><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679076579"><span class="hs-identifier hs-var">ss</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ByteString] -&gt; ByteString
</span><a href="Data.ByteString.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; [ByteString]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#intersperse"><span class="hs-identifier hs-var">List.intersperse</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076578"><span class="hs-identifier hs-var">nl</span></a></span><span> </span><span class="annot"><span class="annottext">[ByteString]
</span><a href="#local-6989586621679076579"><span class="hs-identifier hs-var">ss</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; ByteString
</span><a href="Data.ByteString.html#append"><span class="hs-operator hs-var">`append`</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076578"><span class="hs-identifier hs-var">nl</span></a></span><span> </span><span class="hs-comment">-- half as much space</span><span>
</span><span id="line-915"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679076578"><span class="annot"><span class="annottext">nl :: ByteString
</span><a href="#local-6989586621679076578"><span class="hs-identifier hs-var hs-var">nl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\n'</span></span><span>
</span><span id="line-916"></span><span>
</span><span id="line-917"></span><span class="hs-comment">-- | 'words' breaks a ByteString up into a list of words, which</span><span>
</span><span id="line-918"></span><span class="hs-comment">-- were delimited by Chars representing white space.</span><span>
</span><span id="line-919"></span><span class="annot"><a href="Data.ByteString.Char8.html#words"><span class="hs-identifier hs-type">words</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-920"></span><span id="words"><span class="annot"><span class="annottext">words :: ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.Char8.html#words"><span class="hs-identifier hs-var hs-var">words</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; Bool) -&gt; [ByteString] -&gt; [ByteString]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">P.filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (ByteString -&gt; Bool) -&gt; ByteString -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">B.null</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([ByteString] -&gt; [ByteString])
-&gt; (ByteString -&gt; [ByteString]) -&gt; ByteString -&gt; [ByteString]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; ByteString -&gt; [ByteString]
</span><a href="Data.ByteString.html#splitWith"><span class="hs-identifier hs-var">B.splitWith</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="Data.ByteString.Internal.html#isSpaceWord8"><span class="hs-identifier hs-var">isSpaceWord8</span></a></span><span>
</span><span id="line-921"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#words"><span class="hs-pragma hs-type">words</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-922"></span><span>
</span><span id="line-923"></span><span class="hs-comment">-- | The 'unwords' function is analogous to the 'unlines' function, on words.</span><span>
</span><span id="line-924"></span><span class="annot"><a href="Data.ByteString.Char8.html#unwords"><span class="hs-identifier hs-type">unwords</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-925"></span><span id="unwords"><span class="annot"><span class="annottext">unwords :: [ByteString] -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#unwords"><span class="hs-identifier hs-var hs-var">unwords</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [ByteString] -&gt; ByteString
</span><a href="Data.ByteString.html#intercalate"><span class="hs-identifier hs-var">intercalate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; ByteString
</span><a href="Data.ByteString.Char8.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">' '</span></span><span class="hs-special">)</span><span>
</span><span id="line-926"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Char8.html#unwords"><span class="hs-pragma hs-type">unwords</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-927"></span><span>
</span><span id="line-928"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-929"></span><span class="hs-comment">-- Reading from ByteStrings</span><span>
</span><span id="line-930"></span><span>
</span><span id="line-931"></span><span class="hs-comment">-- | readInt reads an Int from the beginning of the ByteString.  If there is no</span><span>
</span><span id="line-932"></span><span class="hs-comment">-- integer at the beginning of the string, it returns Nothing, otherwise</span><span>
</span><span id="line-933"></span><span class="hs-comment">-- it just returns the int read, and the rest of the string.</span><span>
</span><span id="line-934"></span><span class="hs-comment">--</span><span>
</span><span id="line-935"></span><span class="hs-comment">-- Note: This function will overflow the Int for large integers.</span><span>
</span><span id="line-936"></span><span class="annot"><a href="Data.ByteString.Char8.html#readInt"><span class="hs-identifier hs-type">readInt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-937"></span><span id="readInt"><span class="annot"><span class="annottext">readInt :: ByteString -&gt; Maybe (Int, ByteString)
</span><a href="Data.ByteString.Char8.html#readInt"><span class="hs-identifier hs-var hs-var">readInt</span></a></span></span><span> </span><span id="local-6989586621679076577"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076577"><span class="hs-keyword hs-var">as</span></a></span></span><span>
</span><span id="line-938"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076577"><span class="hs-keyword hs-var">as</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Int, ByteString)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-939"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-940"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Char
</span><a href="Data.ByteString.Char8.html#unsafeHead"><span class="hs-identifier hs-var">unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076577"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-941"></span><span>            </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Int -&gt; Int -&gt; ByteString -&gt; Maybe (Int, ByteString)
</span><a href="#local-6989586621679076576"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>  </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">B.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076577"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-942"></span><span>            </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'+'</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Int -&gt; Int -&gt; ByteString -&gt; Maybe (Int, ByteString)
</span><a href="#local-6989586621679076576"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">B.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076577"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-943"></span><span>            </span><span class="annot"><span class="annottext">Char
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Int -&gt; Int -&gt; ByteString -&gt; Maybe (Int, ByteString)
</span><a href="#local-6989586621679076576"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076577"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-944"></span><span>
</span><span id="line-945"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span class="annot"><a href="#local-6989586621679076576"><span class="hs-identifier hs-type">loop</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-946"></span><span>          </span><span id="local-6989586621679076576"><span class="annot"><span class="annottext">loop :: Bool -&gt; Int -&gt; Int -&gt; ByteString -&gt; Maybe (Int, ByteString)
</span><a href="#local-6989586621679076576"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span id="local-6989586621679076575"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679076575"><span class="hs-identifier hs-var">neg</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679076574"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076574"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679076573"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076573"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679076572"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076572"><span class="hs-identifier hs-var">ps</span></a></span></span><span>
</span><span id="line-947"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076572"><span class="hs-identifier hs-var">ps</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Int -&gt; Int -&gt; ByteString -&gt; Maybe (Int, ByteString)
forall {a} {a} {b}.
(Eq a, Num a, Num a) =&gt;
Bool -&gt; a -&gt; a -&gt; b -&gt; Maybe (a, b)
</span><a href="#local-6989586621679076571"><span class="hs-identifier hs-var">end</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679076575"><span class="hs-identifier hs-var">neg</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076574"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076573"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076572"><span class="hs-identifier hs-var">ps</span></a></span><span>
</span><span id="line-948"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-949"></span><span>                  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">B.unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076572"><span class="hs-identifier hs-var">ps</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-950"></span><span>                    </span><span id="local-6989586621679076570"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076570"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076570"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0x30</span></span><span>
</span><span id="line-951"></span><span>                     </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076570"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0x39</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Int -&gt; Int -&gt; ByteString -&gt; Maybe (Int, ByteString)
</span><a href="#local-6989586621679076576"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679076575"><span class="hs-identifier hs-var">neg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076574"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-952"></span><span>                                          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076573"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">10</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076570"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0x30</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-953"></span><span>                                          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">B.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076572"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-954"></span><span>                      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Int -&gt; Int -&gt; ByteString -&gt; Maybe (Int, ByteString)
forall {a} {a} {b}.
(Eq a, Num a, Num a) =&gt;
Bool -&gt; a -&gt; a -&gt; b -&gt; Maybe (a, b)
</span><a href="#local-6989586621679076571"><span class="hs-identifier hs-var">end</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679076575"><span class="hs-identifier hs-var">neg</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076574"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076573"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076572"><span class="hs-identifier hs-var">ps</span></a></span><span>
</span><span id="line-955"></span><span>
</span><span id="line-956"></span><span>          </span><span id="local-6989586621679076571"><span class="annot"><span class="annottext">end :: Bool -&gt; a -&gt; a -&gt; b -&gt; Maybe (a, b)
</span><a href="#local-6989586621679076571"><span class="hs-identifier hs-var hs-var">end</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span>    </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (a, b)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-957"></span><span>          </span><span class="annot"><a href="#local-6989586621679076571"><span class="hs-identifier hs-var">end</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679076560"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076560"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679076559"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679076559"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a, b) -&gt; Maybe (a, b)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076560"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679076559"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-958"></span><span>          </span><span class="annot"><a href="#local-6989586621679076571"><span class="hs-identifier hs-var">end</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span>    </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679076558"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076558"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679076557"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679076557"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a, b) -&gt; Maybe (a, b)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076558"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679076557"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-959"></span><span>
</span><span id="line-960"></span><span class="hs-comment">-- | readInteger reads an Integer from the beginning of the ByteString.  If</span><span>
</span><span id="line-961"></span><span class="hs-comment">-- there is no integer at the beginning of the string, it returns Nothing,</span><span>
</span><span id="line-962"></span><span class="hs-comment">-- otherwise it just returns the int read, and the rest of the string.</span><span>
</span><span id="line-963"></span><span class="annot"><a href="Data.ByteString.Char8.html#readInteger"><span class="hs-identifier hs-type">readInteger</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-964"></span><span id="readInteger"><span class="annot"><span class="annottext">readInteger :: ByteString -&gt; Maybe (Integer, ByteString)
</span><a href="Data.ByteString.Char8.html#readInteger"><span class="hs-identifier hs-var hs-var">readInteger</span></a></span></span><span> </span><span id="local-6989586621679076556"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076556"><span class="hs-keyword hs-var">as</span></a></span></span><span>
</span><span id="line-965"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076556"><span class="hs-keyword hs-var">as</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Integer, ByteString)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-966"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-967"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Char
</span><a href="Data.ByteString.Char8.html#unsafeHead"><span class="hs-identifier hs-var">unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076556"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-968"></span><span>            </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Maybe (Integer, ByteString)
</span><a href="#local-6989586621679076555"><span class="hs-identifier hs-var">first</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">B.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076556"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe (Integer, ByteString)
-&gt; ((Integer, ByteString) -&gt; Maybe (Integer, ByteString))
-&gt; Maybe (Integer, ByteString)
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621679076554"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679076554"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679076553"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076553"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Integer, ByteString) -&gt; Maybe (Integer, ByteString)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679076554"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076553"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-969"></span><span>            </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'+'</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Maybe (Integer, ByteString)
</span><a href="#local-6989586621679076555"><span class="hs-identifier hs-var">first</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">B.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076556"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-970"></span><span>            </span><span class="annot"><span class="annottext">Char
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Maybe (Integer, ByteString)
</span><a href="#local-6989586621679076555"><span class="hs-identifier hs-var">first</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076556"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-971"></span><span>
</span><span id="line-972"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679076555"><span class="annot"><span class="annottext">first :: ByteString -&gt; Maybe (Integer, ByteString)
</span><a href="#local-6989586621679076555"><span class="hs-identifier hs-var hs-var">first</span></a></span></span><span> </span><span id="local-6989586621679076544"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076544"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076544"><span class="hs-identifier hs-var">ps</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Integer, ByteString)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-973"></span><span>                   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-974"></span><span>                       </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">B.unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076544"><span class="hs-identifier hs-var">ps</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-975"></span><span>                        </span><span id="local-6989586621679076543"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076543"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076543"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0x30</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076543"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0x39</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Integer, ByteString) -&gt; Maybe (Integer, ByteString)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">((Integer, ByteString) -&gt; Maybe (Integer, ByteString))
-&gt; (Integer, ByteString) -&gt; Maybe (Integer, ByteString)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-976"></span><span>                            </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; [Integer] -&gt; ByteString -&gt; (Integer, ByteString)
</span><a href="#local-6989586621679076542"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076543"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0x30</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">B.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076544"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-977"></span><span>                          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe (Integer, ByteString)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-978"></span><span>
</span><span id="line-979"></span><span>          </span><span class="annot"><a href="#local-6989586621679076542"><span class="hs-identifier hs-type">loop</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-980"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-981"></span><span>          </span><span id="local-6989586621679076542"><span class="annot"><span class="annottext">loop :: Int -&gt; Int -&gt; [Integer] -&gt; ByteString -&gt; (Integer, ByteString)
</span><a href="#local-6989586621679076542"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679076541"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076541"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679076540"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076540"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span id="local-6989586621679076539"><span class="annot"><span class="annottext">[Integer]
</span><a href="#local-6989586621679076539"><span class="hs-identifier hs-var">ns</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679076538"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076538"><span class="hs-identifier hs-var">ps</span></a></span></span><span>
</span><span id="line-982"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="Data.ByteString.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076538"><span class="hs-identifier hs-var">ps</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; [Integer] -&gt; ByteString -&gt; (Integer, ByteString)
forall {a} {b} {b}.
(Integral a, Integral b) =&gt;
b -&gt; a -&gt; [Integer] -&gt; b -&gt; (Integer, b)
</span><a href="#local-6989586621679076537"><span class="hs-identifier hs-var">combine</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076541"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076540"><span class="hs-identifier hs-var">acc</span></a></span><span> </span><span class="annot"><span class="annottext">[Integer]
</span><a href="#local-6989586621679076539"><span class="hs-identifier hs-var">ns</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-983"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-984"></span><span>                  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8
</span><a href="Data.ByteString.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">B.unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076538"><span class="hs-identifier hs-var">ps</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-985"></span><span>                   </span><span id="local-6989586621679076536"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076536"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076536"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0x30</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076536"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0x39</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-986"></span><span>                       </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076541"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">9</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; [Integer] -&gt; ByteString -&gt; (Integer, ByteString)
</span><a href="#local-6989586621679076542"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076536"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0x30</span></span><span class="hs-special">)</span><span>
</span><span id="line-987"></span><span>                                           </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076540"><span class="hs-identifier hs-var">acc</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; [Integer] -&gt; [Integer]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[Integer]
</span><a href="#local-6989586621679076539"><span class="hs-identifier hs-var">ns</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-988"></span><span>                                           </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">B.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076538"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-989"></span><span>                                 </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; [Integer] -&gt; ByteString -&gt; (Integer, ByteString)
</span><a href="#local-6989586621679076542"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076541"><span class="hs-identifier hs-var">d</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-990"></span><span>                                           </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">10</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076540"><span class="hs-identifier hs-var">acc</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679076536"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0x30</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-991"></span><span>                                           </span><span class="annot"><span class="annottext">[Integer]
</span><a href="#local-6989586621679076539"><span class="hs-identifier hs-var">ns</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; ByteString
</span><a href="Data.ByteString.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">B.unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076538"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-992"></span><span>                     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; [Integer] -&gt; ByteString -&gt; (Integer, ByteString)
forall {a} {b} {b}.
(Integral a, Integral b) =&gt;
b -&gt; a -&gt; [Integer] -&gt; b -&gt; (Integer, b)
</span><a href="#local-6989586621679076537"><span class="hs-identifier hs-var">combine</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076541"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679076540"><span class="hs-identifier hs-var">acc</span></a></span><span> </span><span class="annot"><span class="annottext">[Integer]
</span><a href="#local-6989586621679076539"><span class="hs-identifier hs-var">ns</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076538"><span class="hs-identifier hs-var">ps</span></a></span><span>
</span><span id="line-993"></span><span>
</span><span id="line-994"></span><span>          </span><span id="local-6989586621679076537"><span class="annot"><span class="annottext">combine :: b -&gt; a -&gt; [Integer] -&gt; b -&gt; (Integer, b)
</span><a href="#local-6989586621679076537"><span class="hs-identifier hs-var hs-var">combine</span></a></span></span><span> </span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679076524"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076524"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621679076523"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679076523"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076524"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679076523"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-995"></span><span>          </span><span class="annot"><a href="#local-6989586621679076537"><span class="hs-identifier hs-var">combine</span></a></span><span> </span><span id="local-6989586621679076522"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679076522"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span id="local-6989586621679076521"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076521"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span id="local-6989586621679076520"><span class="annot"><span class="annottext">[Integer]
</span><a href="#local-6989586621679076520"><span class="hs-identifier hs-var">ns</span></a></span></span><span> </span><span id="local-6989586621679076519"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679076519"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-996"></span><span>              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">10</span></span><span class="annot"><span class="annottext">Integer -&gt; b -&gt; Integer
forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Real.html#%5E"><span class="hs-operator hs-var">^</span></a></span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679076522"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; [Integer] -&gt; Integer
forall {a}. Num a =&gt; a -&gt; [a] -&gt; a
</span><a href="#local-6989586621679076517"><span class="hs-identifier hs-var">combine1</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1000000000</span></span><span> </span><span class="annot"><span class="annottext">[Integer]
</span><a href="#local-6989586621679076520"><span class="hs-identifier hs-var">ns</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076521"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679076519"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-997"></span><span>
</span><span id="line-998"></span><span>          </span><span id="local-6989586621679076517"><span class="annot"><span class="annottext">combine1 :: a -&gt; [a] -&gt; a
</span><a href="#local-6989586621679076517"><span class="hs-identifier hs-var hs-var">combine1</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span id="local-6989586621679076513"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076513"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076513"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-999"></span><span>          </span><span class="annot"><a href="#local-6989586621679076517"><span class="hs-identifier hs-var">combine1</span></a></span><span> </span><span id="local-6989586621679076512"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076512"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621679076511"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679076511"><span class="hs-identifier hs-var">ns</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; a
</span><a href="#local-6989586621679076517"><span class="hs-identifier hs-var">combine1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076512"><span class="hs-identifier hs-var">b</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076512"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([a] -&gt; a) -&gt; [a] -&gt; a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {a}. Num a =&gt; a -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621679076510"><span class="hs-identifier hs-var">combine2</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076512"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679076511"><span class="hs-identifier hs-var">ns</span></a></span><span>
</span><span id="line-1000"></span><span>
</span><span id="line-1001"></span><span>          </span><span id="local-6989586621679076510"><span class="annot"><span class="annottext">combine2 :: a -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621679076510"><span class="hs-identifier hs-var hs-var">combine2</span></a></span></span><span> </span><span id="local-6989586621679076508"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076508"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679076507"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076507"><span class="hs-identifier hs-var">n</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679076506"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076506"><span class="hs-identifier hs-var">m</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679076505"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679076505"><span class="hs-identifier hs-var">ns</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679076502"><span class="annot"><span class="annottext">t :: a
</span><a href="#local-6989586621679076502"><span class="hs-identifier hs-var hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076506"><span class="hs-identifier hs-var">m</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076508"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076507"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076502"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Prim.html#seq"><span class="hs-operator hs-var">`seq`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076502"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621679076510"><span class="hs-identifier hs-var">combine2</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679076508"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679076505"><span class="hs-identifier hs-var">ns</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1002"></span><span>          </span><span class="annot"><a href="#local-6989586621679076510"><span class="hs-identifier hs-var">combine2</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679076501"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679076501"><span class="hs-identifier hs-var">ns</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679076501"><span class="hs-identifier hs-var">ns</span></a></span><span>
</span><span id="line-1003"></span><span>
</span><span id="line-1004"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-1005"></span><span class="hs-comment">-- For non-binary text processing:</span><span>
</span><span id="line-1006"></span><span>
</span><span id="line-1007"></span><span class="hs-comment">-- | Write a ByteString to a handle, appending a newline byte</span><span>
</span><span id="line-1008"></span><span class="annot"><a href="Data.ByteString.Char8.html#hPutStrLn"><span class="hs-identifier hs-type">hPutStrLn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1009"></span><span id="hPutStrLn"><span class="annot"><span class="annottext">hPutStrLn :: Handle -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.Char8.html#hPutStrLn"><span class="hs-identifier hs-var hs-var">hPutStrLn</span></a></span></span><span> </span><span id="local-6989586621679076500"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679076500"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span id="local-6989586621679076499"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076499"><span class="hs-identifier hs-var">ps</span></a></span></span><span>
</span><span id="line-1010"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="Data.ByteString.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076499"><span class="hs-identifier hs-var">ps</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1024</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.html#hPut"><span class="hs-identifier hs-var">hPut</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679076500"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076499"><span class="hs-identifier hs-var">ps</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Word8 -&gt; ByteString
</span><a href="Data.ByteString.html#snoc"><span class="hs-operator hs-var">`B.snoc`</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0x0a</span></span><span class="hs-special">)</span><span>
</span><span id="line-1011"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.html#hPut"><span class="hs-identifier hs-var">hPut</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679076500"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679076499"><span class="hs-identifier hs-var">ps</span></a></span><span> </span><span class="annot"><span class="annottext">IO () -&gt; IO () -&gt; IO ()
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Handle -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.html#hPut"><span class="hs-identifier hs-var">hPut</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679076500"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; ByteString
</span><a href="Data.ByteString.html#singleton"><span class="hs-identifier hs-var">B.singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0x0a</span></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- don't copy</span><span>
</span><span id="line-1012"></span><span>
</span><span id="line-1013"></span><span class="hs-comment">-- | Write a ByteString to stdout, appending a newline byte</span><span>
</span><span id="line-1014"></span><span class="annot"><a href="Data.ByteString.Char8.html#putStrLn"><span class="hs-identifier hs-type">putStrLn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1015"></span><span id="putStrLn"><span class="annot"><span class="annottext">putStrLn :: ByteString -&gt; IO ()
</span><a href="Data.ByteString.Char8.html#putStrLn"><span class="hs-identifier hs-var hs-var">putStrLn</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; ByteString -&gt; IO ()
</span><a href="Data.ByteString.Char8.html#hPutStrLn"><span class="hs-identifier hs-var">hPutStrLn</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="../../base/src/GHC.IO.StdHandles.html#stdout"><span class="hs-identifier hs-var">stdout</span></a></span><span>
</span><span id="line-1016"></span></pre></body></html>